I have to second the headphones idea. And if you don't think you like techno or trance music, you might change your mind after you code while listening to it (which is about the only time I listen to it).
Stuff with a white-noisy background and a steady, brisk rhythm tends to block out the din of the workplace and helps me stay focused for longer periods of time. Was the only way I could cope with the loud, obnoxious sales staff sitting nearby. Oh, and avoid music with lyrics.
Similarly, jazz and classical work beautifully as working music. I code most often to Gould, and my favorite music for mental jams is to put my Thelonious Monk collection on shuffle.
Stuff with a white-noisy background and a steady, brisk rhythm tends to block out the din of the workplace and helps me stay focused for longer periods of time. Was the only way I could cope with the loud, obnoxious sales staff sitting nearby. Oh, and avoid music with lyrics.