Simply looking unruffled is one way of dealing with sarcasm. If the comment is an insult directed specifically at you, Pierre Trudeau's famous "I've been called worse things by better men" works. Another option comes from Irish author Oscar Wilde: "Some cause happiness wherever they go; others whenever they go."
Fighting sarcasm with sarcasm is a popular option, and insulting your opponent's intelligence is one way of doing this. Novelist Ilka Chase, for example, heard the following from an unnamed actress: "I enjoyed reading your book. Who wrote it for you?" Chase responded with "Darling, I'm so glad you liked it. Who read it to you?"
When Winston Churchill received a letter from playwright George Bernard Shaw worded "I am enclosing two tickets to the first night of my new play; bring a friend ... if you have one," Churchill replied, "Cannot possibly attend first night; will attend second, if there is one."
Another sarcastic comeback, again from Wilde is: "There is only one thing worse than being talked about, and that is not being talked about." This tells your opponent that no matter what he might say about you, you have the upper hand since you were worthy of a remark in the first place.