Ignore is your first line of defense. You always have the option to /ignore someone. That's your first line of defense. Blizzard's back-end system will help make sure you don't have to deal with someone you've /ignored. The person's text gets blocked from your chatbox, and they disappear from your life. That's a good thing. Ignore away.
The downside is that ignoring a player isn't a universal solution. If other players are responding to the troll's commentary, you'll see those responses. You could still get tossed in a group manually with the person. You could still encounter them on other accounts, on the forums, and elsewhere.
So ignoring a player is your first line of defense, but it won't fix everything.
Use your mental ignore button. I won't harp on this in too much detail right here, but using your own internal ignore button is your next line of defense. While I personally like to combat ignorance and misogyny everywhere I encounter it ... that's not actually always helpful.
Here's the thing. A few witty lines of banter, no matter how clever you are, fired across the internet in an online video game isn't going to do anything to change anyone. When you get in an argument with a troll, you're really just arguing for your own sake. You're not going to change that person at all.
If you find yourself getting worked up by another player's behavior, queue up your own internal ignore function. Walk away from the computer for the night, if you must. Remember, you're not going to change a troll's opinion, especially not if that troll's a fan of vile rhetoric. Save yourself some anguish and walk away.
Report the chap. Sometimes it just comes down to this: A person is so systematic and pervasive with their abuse, so toxic to the environment, that just walking away won't get the job done. If a troll's ongoing behavior is making your playing environment a bad place, report them for spamming and abusive behavior.
This isn't a catch-all solution, of course. Blizzard is swamped with customer tickets, and the customer service team does its best to be fair to everyone. Nonetheless, if you think somebody is crossing the line, Blizzard deserves to be in the loop.
Walk away. When all else fails, consider walking away from the bad environment. Is the troll a guild member? Bail on the guild. Is the troll constantly lurking in general chat? Leave that chat -- hell, leave the server if you must. But if ignoring and reporting doesn't work, your best option is to find higher ground ... elsewhere.
Don't give in to the argument. I mentioned this briefly, but I want to circle around to it again. It's tempting to get into neverending arguments with trolls. But the problem is that those arguments are neverending for a reason.
It doesn't matter if a person is demeaning to women, spouting racist nonsense, or just being obnoxious -- whatever mental tic motivates that person will be pleased as punch to engage in argument with you. It validates the behavior and reinforces the troll's belief. That person will literally thrill to get into an argument.
And you're not going to change the behavior, you'll just feed it. So avoid the argument, both so that the troll doesn't gain further power from you but also for the simple sake of your own sanity.
Visit the WoW Rookie Guide for links to everything you need to get started as a new player, from how to control your character and camera angles when you're just starting out, to learning how to tank, getting up to speed for heroics and even how to win Tol Barad.