Believe it or not during the beginning of fermentation and up to about 2 weeks some of us don't use airlocks. When I used to ferment in carboys I used to just pit foil over the opening. Bugs fall down, not sideways or up, so for the most part you are safe. But eventually the co2 will mix with the o2 and acetobacter will take hold and even this isn't necessarily the end-game if you catch it early.
After fermentation stops producing co2 and there is no longer positive pressure your chances of infection drastically start to increase. But during active fermentation it is very difficult to infect a beer from outside environment unless you are completely open to the elements. That said, there are a lot of breweries that open ferment. If your room is clean enough even then you might could get away with a beer open to the elements.