Yes! Maybe it could work like those song recognition apps. A microphone identifies the background music and then it plays an inverse waveform in to your earbuds to cancel it out. I would pay lots of money for that.
Active noise cancellation devices that I've heard of try to analyze the noise to predict what it will do next so they know what to cancel out. They're expensive because they have to be fast enough to react to changes in the sound, and imperfect because they will always lag behind changes to the sound they're trying to cancel.
If you could identify the song then you could simply fast-forward it to know "what it will do next" and the cancellation would be much easier and more accurate.
Combine that with a speech analyzer and synthesizer and you could theoretically even eliminate the voices of individual people (particularly that annoying person who sits near you in a cafe/plane/work).