A hat puzzle

A good puzzle from our friends at Futility Closet:

Three logicians walk into a bar. Each is wearing a hat that's either red or blue. Each logician knows that the hats were drawn from a set of three red and two blue hats; she doesn't know the color of her own hat but can see those of her companions.

The waiter asks, "Do you know the color of your own hat?"

The first logician answers, "I do not know."

The second logician answers, "I do not know."

The third logician answers, "Yes."

What is the color of the third logician's hat?

Puzzle by MIT mathematician Tanya Khovanova. Click here for answer.