But that's just it... there are plenty of ways that the characters could know.
Point being, anything that would let your characters have information is also a path to give up information. The only way you can get good, clear information about what's going on outside of a barn is to be outside of that barn. If you're taking watches and patrolling around that barn, you can be seen. If you're holed up inside the barn and never leave the barn, you can't see if people are approaching. If you're looking out small holes in the barn, your field of vision is quite limited. You take less risk of being seen (effectively none), but in exchange you give up all the information not directly in front of the hole you're looking out of.
The GM could have just as easily narrated soldiers going door to door in town, or a sketchy neighbor taking notice of us, or any number of other things. He could have asked us to make rolls to notice these things, and if we rolled poorly, so be it.
If you're holed up in a barn, how would you know the soldiers were going door to door? Someone running you food and information from the outside? Why assume they're invisible? If you're outside the barn for a sketchy neighbor to see you, 1) why assume you couldn't have been spotted, and; 2) why would you assume you'd notice someone else paying attention?
In the before times, have you ever been in a public place and later at some point a friend told you that they saw you there, maybe even called out to you, but you didn't notice? Yeah. That's a thing that happens. Just because someone sees you has no real bearing on whether you see them. As an example from the game, stealth. That's literally the point of stealth.
This is part of that main character thing. RPGs aren't movies. They're not TV shows. The audience (the players) shouldn't get to see things that the characters don't know. Why? Because the audience is the players...the one's controlling the characters in the fiction. The players will almost certainly immediately act on that information. Like the party is separated and one person is off on their own and in trouble...magically, everyone else at the table suddenly has super urgent business with that PC. Gamers metagaming instead of roleplayers staying in the fiction.
He had a choice... decide what happens on his own, or set things up so that the players and the system have a say in what happens.
That's the crux of the issue. The system is agnostic on this point. It's explicitly left up to the referee to decide. The referee railroaded you. And that sucks. That's a terrible move.
What if they can't know something solely because the GM decided they can't?
That describes almost literally everything in the game. The referee decides that your character cannot know what's happening on the far side of the world, but that's not generally a problem as it doesn't directly affect your character. But yeah, that's how RPGs with referees work. It's up to the referee. Even in games like PbtA. Fronts and factions and NPCs continuing to exist outside the characters' ability to perceive is standard. This is also why I'm an over prepped referee rather than an improviser. The NPCs have a plan and they stick to it unless the PCs interfere. That way there's less chance of players being justifiably cranky. Some player calls me out on something and I'll have a section of notes to show them. Yes, in fact this is exactly what they had planned. They were in the middle of carrying it out and you happened to blunder in. Sorry.
I would think anyone would prefer that there be a chance for the players to learn relevant information so that they can make decisions.
If it's justified in the fiction, absolutely. I'm not going to impart spot instances of omniscience to the characters. If the players want information they have to position their characters in the fiction in such a way as it would be possible for their characters to learn it. They players don't simply get information their characters could not possibly have.
The argument against that... that the GM should just be considering all this in his head to determine the outcome... doesn't seem a strong argument against Mother May I. It seems to embrace it.
If how you define MMI is the referee gets to make decisions, then I don't know what to tell you because that's the defining feature of RPGs. If you want a game where there's either no referee or the referee cannot make decisions, you should look outside of RPGs for that. Again, even games like Fiasco and PbtA have (even temporary) referees and they are able to make decisions. In FKR, referees are advised to be open and honest and freely discuss their decisions and decision making process with players after the fact. That's the approach I take even when not running in that style as I think it's solid advice all around. If the referee makes a decision it should be solidly justified by the fiction and nothing else. That's clearly not what happened here. The referee railroaded you and you're justifiably upset.
I just would have liked to play!
You did get to play. The referee simply didn't give you the outcome you wanted from a declaration. You played up to that moment and you played after that moment. The question is how much are you "playing" in that moment when the referee negated your agency I'd say none. But that's railroading. The referee negating the players' agency so their plans can be preserved.
As for immersion... I don't agree with your assessment. While I would say that rules can sometimes feel intrusive to the fiction that's being established, it's certainly not a given. And I would argue that rules can serve... I'd even go as far as to say must serve... as part of the player's understanding of the fiction. They help provide context to the player that they otherwise cannot have compared to the character, who is a person in a specific location, with an abundance of information available to them.
Totally disagree. Rules just get in the way, simple as. But then this goes back to the notion of invisible rulebooks and how much a shared understanding of genre can stand in for "proper rules" to play a game. I think you can free-form RP without a single die ever tossed. I also think you can RP with only a few rolls over an entire campaign. I honestly prefer it. The dice only need to come out when there's something at stake and the outcome isn't obvious from the fiction. And even then, the dice mechanics don't need to be more involved than 2d6. But that's me.
Probably by considering what is gained by keeping the information hidden.
Verisimilitude.
And by considering what is lost by keeping the information hidden.
Metagaming.
You keep information from the player that the character wouldn't know to increase verisimilitude and decrease metagaming. That's a trade I will gladly make every single time. If the player thinks that they cannot play an RPG without a boardgame-like god's-eye-view of the situation, well, then they are not a good fit for my table.