That's the thing with cats, though. They're always going to find a way to do as they please. I don't think you can really keep the cat out of your room, though I do know, that with aquariums--we use those for our gerbils--that you can ensure that the cat won't get in by purchasing clips to place on either side of the lid. I actually recommend you replace your hamsters' cage with a glass aquarium, though. For your two hamsters living together, 10 gallons would be good. You can find the clips in a pet store where they sell the wire lids for aquarium tanks (which you'll also want instead of the glass lid so your little guys don't suffocate).
We don't have any cats, and there'll be moments where our little guys are as freaked out as ever, but they always bounce back from it. It's instinct for them to get protective, whether or not it's due to the presence of your cat. So, they should be alright. Just make sure not to have the hamsters out of their cage when the cat enters the room. The cage will give them a sense of security.
I wish you luck.