Prayer on the roof of the Ka'bah is valid but disliked because of the issue of respect.

Prayer inside, on, and around the Ka'bah