I'm not sure if there's a flaw in this or not, but here's my attempt:
The person who can see 99 hats (ie the 100th person) should inspect all the hats in front of them. If there is an even number of red hats, they should say "red". If there is an odd number of red hats, they should say "blue"...