After sustaining damage from any source, a
mob will turn red in color for a short period of time. During this period, any other incoming damage will not be counted against the mob's total health. For instance, if you attack a mob with a
Sword repeatedly hitting the mouse button, the sword's rate of fire will exceed the mob's allowable rate of incoming damage, and several of the attacks will not damage the mob even if they land. However, if a mob or player is recovering from damage and then receives higher damage, it gets counted.
Players are also subject to damage immunity.
I believe the period is about .5 seconds
http://www.minecraftwiki.net/wiki/Hearts#Damage_immunity
It used to be really obvious with spout plugin as a ninja last map popping up tons of damage indicators, I'm glad to educate I guess.