There is a base chance for a deathclaw attack. You can do things to increase the chance for an attack. Opening the vault. door, radio broadcasts (as near as I can determine, this happens when you click on the vault door icon in the radio room to call in a new dweller) and any kind of vault construction (adding rooms, destroying rooms and upgrading rooms) are the things that will increase the chance of an attack.
As for dealing with an attack...
Typically, you cannot stop them in one room. It generally takes the deathclaws to move through two or three rooms. Their route of travel is from the vault door to the right most room on the top floor, The will then create a hole in the floor and drop down to the second floor where they will move from right to left. They will continue through the floors, left to right, then right to left, then left to right, etc. until they are killed or have moved through the entire vault.
You do NOT want to construct your vault in such a manner that would cause the deathclaws to backtrack. The reason is that in most cases the deathclaws do not remain in a room long enough to kill everyone, but if they do return to a room they have already been in, they will wipe out the survivors.
My deathclaw defense consists of three, three-wide rooms. The one on the first floor is a power room and is where all my highest level dwellers are with my best weapons. I have an empty two-wide storage room to the right of my first floor power room. Just below that storage room is another empty storage room. Then to the left of that (just under my first floor power room) is my second three-wide defense room (currently it is a diner). This room is filled with my second highest dwellers with my second best weapons. This is the room that the deathclaws are usually stopped. Ever so often, they make it past this room and go into my last three-wide defense room (You guessed it. It contains my third highest leveled dwellers with my third best weapons). The deathclaws have never gotten beyond that third room. I have also only had two dwellers killed by deathclaws (for some reason, one of them doubled back and killed two of my defenders in the first room).
One thing, if one of the defense rooms you set up is a living quarters, you will want to fully staff it with all male or all female dwellers for obvious reasons.
Deathclaws are more of an annoyance than anything else, if you are prepared for them. It is the thrice damned mole rats that give me the drizzles.