You can say the king and queen live in a palace. One the is enough for both nouns in the phrase. It's the same with a, however, the second sentence sounds a bit unnatural.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.