First of all, I think the question is off-topic here.
Second, heater = water boiler?
Then: Can it be done in real time? Basically, yes and not.
What you are asking is to perform some "narrow-band" (meaning you are interested in specific frequencies) noise cancelling. If you look for articles (scientific papers) about "active noise cancelling" (ANC) you will find that the topic is VERY complex. In small environments (... I mean inside headphones, VERY small environments) you can get good results. Check the reviews of the Bose QuietComfort product line. In rooms... not so much. http://facta.junis.ni.ac.rs/walep/walep98/walep98-07.pdf
You will also find out that noise cancelling is easy on low frequencies (<500 Hz) and more and more difficult on higher frequencies. ANC on 6800 Hz is tricky: the wavelength of the sound is 5cm only. Moreover, the source of the sound is a big volume of space (the heater) and that sound bounces on walls, producing an irregular pattern in the rooms. If you place a speaker that (hypothetically) generates exactly the opposite noise, but the speaker is displaced by 30 cm from the noise source, the way this new sound bounces around will be different and you will end up with regions of space where you have noise reduction and regions of space where the noise is increased. You may have experienced it in the past, when different transformers in a room (typically used for different halogen lamps) vibrate: if you move your head by few centimetres (5-10cm) the noise of the different transformers cancels itself (they all vibrate at the same frequency) or gets stronger.
Nevertheless, with some assumptions, you MAY be able to get some results.
First of all, you cannot do it with normal computers: the times it takes for the sound to be digitised by the mic, transmitted to the central processor, processed, transmitted back to the audio card, played back again is too long: every step in a computer brings delays, since computers are not meant to be realtime, they are meant to do as many calculations as possible with multiple apps. If you are serious (even only "seriously interested"), you need a DSP board. Look for TMS320Cxx (xx >= 30) development kits: they offer two audio inputs, two outputs, powerful processors (low latency and optimised for the calculations you need) and they usually come with sample programs that already do what you need. Price: under 120 dollars.
With one of those you may try "feed-forward narrowband noise cancelling" (google that) and you could get maybe 10-15 dB reduction. Important: be ready to accept complete failure.
It is important to reproduce the spatial distribution of the noise, therefore try to keep the heater in a room that is almost closed, so that the noise can get out in a predictable path. Even better, try to build a padded case around the heater, so that its noise gets out in a directional way.
BUT...
If it is the water heater that bugs you, I would really go for passive insulation, that above 2 kHz works extremely well. Some sound-absorbing panels placed close to it would help a lot.
If you mean the heaters in the various rooms, ANC is almost impossible, since you have a source of sound with a huge surface and reproducing similar cancelling noise will be impossible. Use some sound absorbing foam around the heater (not in contact with it, of course).
In the case of room heaters, and if the noise arrives from vibrations in the inner fluid (water) (vs vibrations of the pipes themselves), you could apply noise cancelling to the fluid. It would be just like narrow-band feed-forward ANC in ducts and it works extremely well. You need a way to detect vibrations (pressure waves) inside the first pipe and another device to produce pressure waves inside the pipe, maybe about a meter farther from the detection.