I wear a hat to davening normally.
Is it better to daven with a minyan without a hat or without a minyan with a hat?
Mi Yodeya is a question and answer site for those who base their lives on Jewish law and tradition and anyone interested in learning more. It only takes a minute to sign up.Sign up to join this community
If appearing at the minyan without hat would disturb the other people (or their standard practice), then you have a question.
Otherwise (e.g. most people at shul don't wear hats), this should be straightforward; daven with the minyan. Shulchan Aruch says "one should strive very much [yishtadel me'od] to daven with a minyan." You won't find anything about hats till 200+ years later, the Chayei Adam talking about birkas hamazon.
You should be dressed for prayer as you would be for when you go out in the street, or possibly like you would dress when going in front of someone important.
The mishna berurah states: And in our times one has to wear a hat on his head by davening like he goes in the street and not just a yarmulke because [currently] that’s not the way to stand in front of important people…. And it all depends on the minhag of the places.
So you would have to see if the minhag is to now wear a hat. Either way it shouldn't take precedence over minyan.
The Rabbinical Journal Hamesivta quotes R' Yisroel Belsky that we don't follow what the gentiles consider "the way to dress by a king" but the way that the Rabbis decided (his proof is that in the past the custom was to take of ones hate when greeting people). Therefore, we still follow the din mentioned in M"B (and others).