Dealing with nasty people can be difficult in any situation. However, nasty coworkers are especially hard to deal with, because they are unavoidable without quitting your job. Barring a change in employment, nasty coworkers require different strategies, depending on the kind of nasty that they are. The biggest thing to remember is to take the high road. This not only maintains your personal integrity, it protects you from potential HR problems if you should sink to their level. Here are a few typical nasty personalities, and some mature but effective ways to deal with them.
The Bully
Bullies come in a few different kinds of packages. He may be the alpha male who screams at you when something goes amiss, or she may be the mean but pretty girl who thinks her looks excuse the unkindness of her words. No matter what, bullies feed on fear and the idea that they can control others by making them uncomfortable. The best way to deal with bullies is to make sure they understand that they can't control you by knocking you off your game. Remain calm, but stand your ground. If they escalate their aggression, consider getting help from HR.
The Backstabber
These are the people who are nice to your face, but will either talk about you or sabotage you behind your back. You likely know who they are, because they are freely complaining about the rest of the office to you as well. These are some of the most dangerous people, because they often have a large following of friends who, in their insecurity, try and get on the good side of this person. They are also the most likely to try and damage your standing with your job in the guise of helping you. The best way to deal with these people is to be polite with boundaries. Don't share anything that can be used against you. Don't be rude, but keep them at arms length and work hard to do your own best work. Protect yourself as much as possible from the damage that people like this can cause without insulting them.
The "I Win" Guy
If you had a bad day, the "I Win" guy had a worse one. If your idea was good, his idea was great. No matter what happens to you, this is the person who will top it. Ultra-competitive coworkers may be this way only when it comes to stories, or they may try and outperform coworkers of the same position. Though some competition can be friendly, healthy and productive for a group and the business they work for, when it is one-sided or extreme, it is often destructive to morale. Often, this is the person who is insecure and looking for vindication. A generous application of the well-placed compliment, when deserved, may be all you need to get this guy to tone down his need to win.