The best way to do this is to prevent rust first. Products like Rustoleum are effective in preventing rust. You could Scotch Guard whatever you are trying to protect, that should help.
Keep the area dry. If you can't then cover the item that makes the stain with something that will keep it away from the surface that you want to protect.
The main way to keep a stain like that from happening is to keep it from soaking in. That means you need to us a quality sealer. As long as you keep resealing it as recommended stains shouldn't be a problem.