The only way you can enter the Dungeon without getting killed by a Dungeon Gaurdian is by killing Skeletron,the Pre-Hardmode version od Skeletron Prime.
Skeletron is made up of two parts,the head and his two hands. He will try to swing his hands at you trying to kill you. Then,his head will start spinning at you. During this,his defence will drop to 0 and then stop and continuing to slap you with his hands.
After you beat Skeletron,you will gain acess to your Dungeon and then you can go into it and get loot.Then the old man will turn into the clothier and then move into a valid,O.K house that has no NPC'S living in it.