They can’t know if they “all” want a beer until all three have made their decision. So the third one can say “yes.”
Not quite.
When each of the first two says “I don’t know,” he is telling the third one that he wants a beer. Because if either one of the first two had not wanted a beer, he would have answered the question, “No.”
That's only half of it — if either of the first two didn't want a beer then they could have answered the question ('No').