As Springheel already explained, surprise and getting advantage from hiding are two different things. Hiding, as said, is a combat action, so you do that during combat.
The rogue for example could run behind the wagon and hide from the two goblins on the other side. Or the rogue could run into...