Removing a stain from carpeting is bad enough -- but what do you do if your hardwood flooring gets stained? Hardwood floors, even when polished, do have a somewhat porous surface. If stains are allowed to set, they can be very difficult to remove. It's important to act quickly when a stain does occur... and to call the professionals if needed.
Begin With a Cleaner
Stains often "come back" because they have fully saturated into the wood of the floor. The more you clean it, the more the stain will rise up from underneath. In order to remove the stain, you need to successfully dilute and clean it. You can do this by thoroughly soaking the area of with hydrogen peroxide, blotting, and then drying. Repeat the process as needed. For fresh stains, this will usually be enough to break down the stain and remove it entirely. For older, set in stains, you may need to do a little more work.
Use a Gentle Abrasive
Using a magic eraser or other type of foam sponge, you may be able to gently abrade a set-in stain. Foam sponges actually work through mechanical action -- friction -- to remove some of the surface of a material. This is not unlike using a very gentle sandpaper. Do not, however, use anything like baking soda on your hardwood floor; it will scratch and become dull. Foam sponges are soft enough that they will not do physical damage. Similarly, you can use a floor buffer on the area in order to remove a stain without having to physically sand the floor. This will only work if the surface of the hardwood is the only thing stained.
Remove the Finish
There are some specialty products called "rejuvenators" which don't just remove stains -- they actually leech into and remove the hardwood floor's finish. These rejuvenators can often remove deep set stains without the need for sanding and refinishing, but you'll need to restore your hardwood floor's finish afterwards. Nevertheless, re-polishing the floor may be preferable to having to sand and refinish it entirely.
Sand and Refinish
If neither a cleaner nor a gentle abrasive works, it's because the stain has both saturated into the wood and set there. The only way to remove this stain will be through sanding and refinishing. And, unfortunately, the stain may have penetrated the hardwood enough that it may actually be easier to simply remove and replace some of the planks.
A professional can offer you a consultation regarding whether or not your hardwood can be saved. Most stains can be removed with a little work, but doing the work incorrectly could cause more damage. Once a stain has been removed, it's important to seal and wax the floor thoroughly so that staining doesn't happen again.