The monthly "Save My Game" column in D&D Insider is just about the only sensible thing Wizards of the Coast have to say on the topic of being a DM. I sadly can't link to it, as WOTC are pretty firm on charging you money to learn how to play their game.
This month the column's on what happens when a player wants to play an evil character; their answer is, largely, "say no unless everyone agrees it's awesome", which is a pretty good answer. It is not by accident that D&D no longer offers you the ability to play "evil" or "chaotic evil" characters, and is a deliberate choice to leave the evil deities out of the Player's Handbook.
The larger issue is this: what happens when a player is breaking the game, and justifying it as "roleplaying"? This is not just players who want to sacrifice everyone to their dark god or pick the party's pockets once per day. It's also overly-preachy paladins, emo loners, and players who want to be merchants in a hack-n-slash extravaganza.
It's important for players to make meaningful choices and have opportunities to express themselves. They should never be asked to act out of character for the sake of getting along. But if a player's breaking the fun, there's no good excuse - they need to be stopped.
There are two elements to this problem.
1) The job of the DM - Communicate your goals clearly
Tell the players what sort of game you're going to be running. Is player infighting encouraged? If you don't explicitly say it is, players should assume they're supposed to be working as a team (unless you're playing World of Darkness or Paranoia, in which case the opposite is true). Establish the genre, tone and pacing up front, and don't be subtle about it. I got called up on this one recently, and for good reason. Players want to experience the story you want to tell, and you need to be communicative in order to let them. There are no bonus points to be won for being needlessly coy.
If you find a player that just doesn't get it, and insists on acting like a jerk, be straight. This is something 7th Sea is explicit about, which other games should probably take on board. Say, "This is a game about heroes. What your character is doing is not heroic. Characters who are not heroes are controlled by me, the GM. I need you to find a way for your character to fit into this story, and if you don't, you're in danger of your character coming over to my side of the table."
You can replace "heroes" with "gentlemen", "sane people" or "surgeons who are not also serial killers", as the case demands. Your players are here to play the game you are running, not some other game, and if they're not cool with that you can ask them to leave. You don't throw dice in chess and you don't murder puppies in heroic fantasy (unless everyone is agreed that it is totally awesome).
2) The job of the players - Err in favour of other people's fun
You're playing a social game and unless you're told otherwise it's a co-operative one. That means you need to be enabling everyone else's fun rather than protecting yours. Definitely roleplay - but find in-character reasons for your character to get along, rather than creating conflict for the sake of your art. If you really can't justify following the plot while staying in character, tell the GM, and let him know what you need to get back on track.
You can say, "There's no way my character would do something so risky unless someone he loved was in danger," or, "I don't think my character would trust this person unless someone else in the group vouches for him." It's usually not hard for the GM to work these kind of things into the story.
Here's an easy first step to being a better player: every time you go to do something, ask, "Am I the only one who will enjoy me doing this?" If the answer is yes, then it probably wasn't a good idea. (Actually, that's a pretty good rule for being a DM, too. Even when you screw the players, they should be enjoying it.)