How to shut ears to office gossip? Our institute has office spaces for the PhD students with a number of cubicles in the same room. I happen to be an introvert and dislike people talking to me when I am in the office space, or otherwise. But people just love to gossip. They will talk about how bad their supervisor is or how bad my supervisor is, and even though a lot of what they say might be true, it takes a lot of unnecessary toll on me. It makes me very unsettled about my future. 

I simply do not understand why people love to talk so much. Are they trying to be helpful? Are the seniors among them trying to guide me? How do I make it happen that I keep going to the office space and not have to make small talk or gossip with other folks there?
I like the headphones idea, and perhaps a baseball cap, worn rather low, would help in a similar way.  Some more ideas:


You could put an embroidered sign on your cubicle wall (or a
calligraphy version) saying something like "If you can't say
something nice, don't say anything at all" or "If you can't say
something nice, say it in French."  If those are too blatant,
perhaps you could post the latter phrase in French.  Or choose one
of the many images available online that represent the concept.
I particularly liked "NO Trashing OR Bashing Zone."
When someone approaches you and starts yakking, there are two ways
of stopping them:

(a) Look interested, respond with a wide variety of facial
expressions, but without saying anything.

(b) Say, "I don't want to lose my train of thought, and I've got a deadline -- can you tell
me the rest tomorrow?"
Start coughing, grab an empty water bottle from your desk drawer, point at your throat, and walk quickly to the bathroom.  If the person is still in your visitor's chair when you come back, point at your throat and communicate nonverbally that you can't talk -- until he goes away.
For the really stubborn person who needs a more careful explanation -- just tell them the truth: "I'm the sensitive type, and when I hear negative remarks, I soak them up like a sponge, and they affect me way too much.  This is nothing against you -- but I have to protect myself.  So when I hear you starting to tell me something that's going to affect me this way, I'm going to say, "I'm sorry, Rafael, but I don't want to listen to this."  (And then if he tries again next week, say it.)