Accessing the dungeon from Hell
Solution 1:
According to the official Terraria wiki, you should avoid getting too close to the dungeon from underground, if you haven't defeated Skeletron yet.
Deep caves and Chasms near the Dungeon should be avoided until Skeletron is defeated, as having a significant portion of the Dungeon on-screen below zero depth is considered being inside it, and Guardians can therefore still spawn.
This means that you do not need to actually be inside the dungeon for the Dungeon Guardian to spawn. The reason for this, is because the Dungeon is not a closed space; in my world for instance, the dungeon was generated with a patch of dirt separating two patches of wall, so I could've entered the dungeon without actually digging through its wall.