You can
definitely ride with headphones if you do it the
right way 
. Personally I love listening to music while training so that I stay motivated. It is dangerous to cut yourself off from your surroundings so I found a way to wear headphones that is much safer. First get a pair of classic over the head style phones with earpads ( the kind that used to come with all portable cd players) if you don't have any. Then put on a helmet (like you should in the first place) and adjust the straps that come down from the corners of the helmet and converge to form the chinstrap so that they are fairly close to your ear and well centered. Then put the headphones on, resting on this convergence point so that they cover your earlobes but not the actual ear canal and have the headband go behind your neck. This method works well, at least for my pair because they have well balanced sound and good base quality. I don't know how well this would work with a pair of phones with weak base because the headphones aren’t firing directly into the ear with this method. This is certainly a great compromise between wearing a pair around your neck and mostly hearing midrange/treble frequencies and possibly damaging them from high volume and wearing headphones traditionally, (it works almost as well as wearing a pair normally, kind of like the difference between listening to music in a stopped car with the windows in a car open instead of closed). This also reduces the audible air turbulence that goes through headphones worn traditionally. Also get a remote for whatever audio device you have if you can and learn the buttons without looking at them. I haven’t tried this mountain biking yet, so I don’t know if large bumps would be a problem but if you have them cradled in and the straps hold the phones against head, this shouldn’t be a problem, if you are worried about breaking your headphones maybe try a rubber band or something to secure them to the helmet straps or just get a cheap pair which is easy to find in this style.