I don't think it is especially dangerous, but I don't listen on my commute. I find there is way too much background noise from traffic for me to really hear or enjoy the tunes. I've even considered putting some ear bud headphones inside some hearing protection ear muffs, but I doubt it would fit with a helmet.
When I ride offroad, I usually listen to my mini disc player, and it seems to keep me pushing myself harder than I would with no supporting soundtrack. You do have to keep your eyes well up the trail, especially in technical sections, or you can get surprised by an oncoming rider. I'm pretty sure I crash more frequently when listening to music, because I push my limits more. That's part of the fun offroad though.