There is a saying that who you socialize with defines who you are.
I find it very inspiring.
Find a healthier socializing way.
Don't fall into the pit of gossip, especially not in the office.
The reason some people participate in workplace gossip in the first place is that they are afraid of being isolated.
If this is exactly your situation, then you are drinking poison to quench thirst.
One of the worst things of workplace gossip is that it does not have much logic. Participants simply hope that other people will recognize their opinions so that they themselves can get emotional satisfaction.