The main cause of discolouration to hardwood flooring is water damage. If water (or any liquid) is left to soak into the floor, the wood will absorb the water and over time will warp and change colour.
The best way to prevent water damage from occurring is to wipe away spills and any water accidents as quickly as possible, and ask all visitors and guests to remove wet outdoor footwear before walking on your floor.
If your hardwood flooring has already become discoloured through water damage, there is very little that you can do to resolve the problem as the planks of flooring are irreparable. The only real option is to remove the flooring, ensure the subfloor is completely dry, and then install new flooring.