It might be possible to generate a tone at the same frequency and shift the phase until it's 180 degrees out of phase with the imagined sound. Perhaps the brain would do the math and cancel the imagined sound?
This can't really be automated since there's no way to measure the imagined sound, but it might be possible to make a little box with knobs - pitch, phase, and volume - that would all one to tune a cancellation frequency.