Dangerous Company
Answer: In his book "Give Us Life" Rabbi Mendel Weinbach tells this story about the saintly Chafetz Chaim (Rabbi Israel Meir Kagan, 1838-1933), whose writings had such a great impact on getting people to guard their tongues:
“Traveling incognito as was his custom while selling books he had authored, the Chafetz Chaim once shared a carriage with butchers and horse traders on their way to a fair. While they spoke of the animals, which was their business, he sat immersed in his thoughts. But when one of them began to speak derisively about another trader, the Chafetz Chaim reproved them about the sin of lashon hara and urged them to continue discussing animals rather than people. Despite their insults he continued to reprimand them, for he consoled himself that while they insulted him they were not indulging in gossip. But when all else failed to quiet them, he asked the driver to let him off in the middle of the way so that he would not have to hear them talk about people."
You may not be in the same position as the Chafetz Chaim to do the required reprimanding, but you can take a hint from him and find a way to change the subject or come up with an excuse to leave their company.