I wanted to ask I have a necklace with a pendant which has the name of Allah, the prophet and the ahlulbayt on it. Is it okay to wear it while in the washroom?

No problem, as long as the name does not touch your skin. However, it is preferable to take it off.