If you ask calmly and politely, they may respect your request and stop immediately. If the gossip continues, you can talk to your supervisor about the situation and ask him to help you. Often, a manager can encourage team members to refrain from unprofessional topics of discussion. If you really want to establish yourself as someone who isn't interested in participating in office gossip or if you're faced with regular gossip, you'll need to be direct about it.
Consider addressing the instigator privately to express your displeasure. Approach your gossipy co-worker in a non-confrontational manner and politely but firmly ask him not to talk more about you or whoever is the target of his gossip. Let them really talk and listen and not react. Instead, see what you can do to change your behavior in the future.
Then thank them for their thanks and establish a new agreement between them that includes that they address you directly in the future instead of talking about it with someone else. Some people insist that office gossip is an essential part of the workplace and a necessary skill to advance their career and, in general, to please others while remaining aware of everything. For example, if the rumors revolve around the timeliness of your work, the next time you have a team meeting, you can simply present a graph showing the timeliness of your work and the results as part of your presentation without referring to anyone's words. Even if you don't contribute to the conversation, you're still guilty by association if you hear someone else's gossip.
If gossip and swear words are about to become unbearable, then one option is to discuss the situation with your manager. This is a difficult topic to address, as it can sometimes be about harassment or intimidation rather than just gossip or discourtesy. The other side of the coin is that gossip is easily considered an unnecessary and potentially lethal part of office culture that kills morale and strains relationships. Gossip is a distraction at work, but it can take a darker turn if it turns into harassment.
You never have to defend yourself, and if you try to defend yourself, you turn what was petty gossip into a conflict. Confront gossip by confronting rumors about you, discouraging gossip about others, and taking steps to stay out of the fray. A positive culture would avoid any kind of gossip or rudeness; it just wouldn't be something done in that culture. Listening to gossip about yourself in the workplace is not pleasant, please alert yourself to a perception that can spread and multiply if you don't take steps to reprimand it.
When all is said and done, being busy doing your job usually works quite well because people who gossip want attention and want to get on stage. A persistent and prolonged gossip must be stopped to avoid potential harm to others and to a company's culture. The fact is that people like to gossip, just take a look at any celebrity-focused magazine or website. When in doubt, compliment the gossiper, ask him to show you pictures of his pets, or find out what his plans are for the weekend.
Pretending that the opinions of these petty people don't matter, and doing your job with dignity and grace and treating all members of the office, including gossipers, with dignity, is the best way to take away the reward from them.