I totally get this. As one who works in a coworking space I have to fend off people all day. I love to talk, but not when I'm trying to write code. Some people don't realize that headphones are the universal sign of "I'm busy".
If people are distracting you, maybe you should, you know, have an actual conversation with them about it. Not everyone views headphones as the universal sign for being busy. Some people (myself included) just like listening to music while we work.