From Neil Gaiman’s Journal, a question from a nascent writer:
“My professor for comic book scripting told me once that it is impossible to listen to music and write at the same time.”

Neil replies:
“What an odd thing to tell people.

I’m sure it’s true for him, mind you, but deciding that it’s true for the rest of the world is a leap of faith I wouldn’t have made, much like deciding that everyone in the world needs to write using your lucky brand of pen or it won’t be any good.”

I do find that occasionally it’s hard to write with music playing, but it’s certainly not a rule of thumb for me.