How did Goddess Sita protect herself in Ravana’s palace?
Ravana was not able to force himself on Sita due to a curse he had received years earlier, as described in this excerpt from the Uttara Kanda of the Ramayana. Ravana and his army were once camped on mount Kailash, preparing to attack Devaloka (the kingdom of the gods), when he saw the Apsara (nymph) Rambha and was enchanted by her beauty. He propositioned her, but she refused his advances, saying that she was like Ravana's daughter-in-law, as she was on her way to see Nalakuvara, son of Ravana's brother Kubera the god of wealth. Ravana paid no heed to this, saying that Rambha was an Apsara, and Apsaras are never wedded to just one husband. He then ravished Rambha. When Nalakuvara heard what had happened, he put the following curse on Ravana:
Oh fair one, since thou hast been ravished despite thy unwillingness he shall never be able to get by an unwilling damsel. Whenever he shall, stricken by lust, ravish a reluctant damsel, his head shall be sundered into seven pieces.
So Ravana couldn't take liberties with Sita against her will. He had to get Sita to marry him voluntarily, although he did use threats to try to convince her. When he first brings her to Lanka, he says this:
Oh, angry lady Maithili, listen to my words. A period of twelve months is given to you. And oh, smiley smiler, if you do not come nigh of me within that period, then the cooks will slice you to pieces for the purpose of a morning meal.
And when Hanuman came to Lanka, he hears Ravana telling Sita that he would keep his word and give her two more months before killing her:
O Seetha with best complexion! Whatever limit has been made by me to you, those two months are protectable to me. Thereafter ascend my bed. Above two months you not desiring me as husband will be killed in my kitchen for my breakfast.
(On a side note, it's probably as good a time as any to mention that Vishnu says in the Skanda Purana that Sita was never actually kidnapped, as I discuss in this answer. If that's the case, then the real answer would be "by not going to the palace at all"!)
Note: “The question: How did Goddess Sita protect herself in Ravana’s palace?” is licensed by Stack Exchange Inc (https://hinduism.stackexchange.com/); user contributions licensed under CC BY-SA.