This is a nearly impossible problem to solve. The standard answer is to get control of your audience. That is easier said than done. I don't know what age you are, but teens are the worst audience, especially if you are a teen. I teach 13 year olds, and they can be bad for me. I have classes that I won't show magic for because there might be one or two who cannot stop messing with the show ("I know how that was done, etc.") Since I am their teacher, I can call parents! I never do, though, unless the kid is psycho

. This knowledge that I can tell on them does not always stop them. Kids this age burn your hands while you work, and they refuse (sometimes) to follow basic misdirection. Some of my students see magic as a challenge and a puzzle. They feel stupid if they don't figure it out. I do not perform magic this way, and I never get this reaction from older or younger people (or even most 13 year olds, to be honest.) But some of these kids can be hard. I have performed enough that it does not bother me a whole lot but once in a while I say why bother?
A few tips:
Don't look too needy. You don't have to show tricks everyday, or even every week. You don't have to show tricks to every person who asks. Make them beg. And still say no.
Don't show magic when you feel the situation is not quite right. We all make that mistake. I was going to show a class a variation of Chicago Opener (Red Hot Mamma,) and I knew that I needed my audience in front of me. I thought I had things set up, but I was not clear about what I wanted the audience to do. By the time I got into the effect, I was surrounded (which is not always bad,) and people were moving which made it hard to keep them focused. What was worse was that some jerk snuck around to my right and got lower than my hands and only two feet away and spotted something. It was my fault, but I still put the cards away when he started to yell out what he saw. I will never show this kid magic again unless he has a religious conversion and proves to me that he has given up his life of jerkiness. And I am his teacher. This kid would kill another 13 year old.
When I do busking routines, I will put down rope to mark the edge of my stage. This does more than indicate where they are to stand; it also sends a message that it is now time for a magic show, which I think makes people more responsive and nicer. You have become the entertainer rather than some kid with a trick.
Make sure you are completely comfortable with the effects you are doing. When I was new, I would show effects too soon after buying them. I thought a day or two of practice was enough. Even when I could do the effect, I was not as smooth as I should have been, which meant that I could not focus on audience management like I needed to. I will now practice, even fairly simple effects, for weeks before I will show them.
Be careful about trying to out heckle the heckler. It can backfire. If you are new, the other kids see you as someone who bought a few tricks. Maybe that is neat to them, maybe not. But watching two people get into a contest of words--now that is really neat, especially if you lose your cool. Remember, you have to know how to do the effect as well as how to out heckle the heckler. All he has to do is heckle. He has it easy. I am not saying, never say anything, just don't expect to win in a match of wits.
Also, remember, that you have control over your reactions. This problem is not the end of life. Things will get better, someday.