Usually, the DM decides when rounds start, and _usually_ this is at the beginning of actual combat. I don't see any particular reason you couldn't start dodging right away — and, in fact, telling the DM that you want to do this would usually start the beginning of combat rounds. (With the DM saying "okay then, roll initiative").

You don't _have_ to do it this way, though, and in fact, I think the normal approach would be to use the _Ready_ action. This is technically also something you do in combat rounds, but in every D&D game I've seen, it's exactly what people do when they want to be prepared for something before combat has started _per se_.

Here, you say "I'm going to ready to dodge when I see a creature on the other side of that door". This works out rationally, because _Dodge_ requires you to be able to see the attacker to work, so there's really no point in having it "active" before that.

On the other hand, _Dodge_ reflects a greater level of alertness all around (as modeled by advantage on Dex saves), and I think it's equally reasonable to say "I'm going to walk into that room on high alert — effectively, I'm taking the dodge action as I go in."

Either way, of course, prevents you from _making an attack_ on your first round, even if there's obviously an enemy there to engage.