I don't think you can really make sure it doesn't attack the snake, but you can take steps to make it less likely. Make sure the rat is well fed prior to being fed off. When you place into the tank/tub, don't dangle it by its tail and drop it in. Hold it and place it in there so it doesn't get all freaked out. Don't leave it unattended with the snake and have something handy (chopstick, pencil, whatever) to stick in its mouth if it attempts to bite.
In my experience, the rat isn't on the war path as soon as its placed in the enclosure. I've had a couple of bites and they usually happen during constriction and there isn't much I can do about it because of positioning. I've never had a severe one that left marks after the next shed.
I could be wrong but I don't think you need to worry too much about a minor bite during feeding. Obviously, there are areas (eyes!) where a minor bite could become a major problem but for the most part, you probably aren't going to have any serious issues as long as you're paying attention. The pictures you see of snakes all chewed up are cases where the rat has been left unattended and unfed for extended periods of time. Those are not the results of a responsible routine feeding.