If I have an ESTA and I apply for visa and the visa is denied, is my ESTA still valid?
You must reapply for an ESTA. The DHS's answer to the question "When do I need to reapply for an ESTA?" states
When do I need to reapply for an ESTA?
A new travel authorization may be required in any of the following circumstances:
- The circumstances underlying the traveler's previous responses to any of the ESTA application questions requiring a "yes" or "no" response have changed.
One of the eligibility questions being:
Have you ever been denied a U.S. visa you applied for with your current or previous passport, or have you ever been refused admission to the United States or withdrawn your application for admission at a U.S. port of entry?