Latency (it has to be exactly zero - that's why this is done with analog circuits)
Distance from speakers to ears (that's why it's only used on headphones)
Distance between speakers and mike (on headphones the mikes are right next to the speakers)
We're talking about simple phase manipulation..
It can be done (in fact, some next-gen cars will use this very thing to cancel out the engine's noise),
but you'll need quite a bit more math
Expert in non-working solutions.
(Signature shamelessly ripped from someone else, is still the truth)