I tell every developer buddy I have that they should get a pair of Fuck Off Headphones [0]. They need to be big enough that people can't try to say, "Oh, I didn't see you had headphones on".
I work from home now, and they work just as well for keeping my family at bay as they did for chatty coworkers when I had to be in an office.
I used to go this route (before I too started a telecommute job), but I've found that Sennheiser's PMX series of running headphones do a great job of isolation without the ear-sweat that comes with the giant cans. They don't have the fuck-off effect, but you are not hearing anything around you and they're super lightweight with great sound.
Which, if you think about it, is probably kind of bad for runners, but I wear them only for code.
This is exactly what I do, as do many folks at my office. I just don't use quite as colorful language. :)
The only downside is that if you use them too much, you might get the reputation for being someone who doesn't have time for questions from colleagues.
At home, I just recently replaced my fraying HD280 Pros with a pair of HD380 Pros. Recommended!
The problem this approach has for me is I get startled if someone suddenly appears in front of me. I find ambient noise works best for me, though these days I find distractions from multiple monitors, tablets and phones are increasingly getting lethal.
I work from home now, and they work just as well for keeping my family at bay as they did for chatty coworkers when I had to be in an office.
[0] http://www.amazon.com/Logitech-Wireless-Gaming-Headset-Surro...