2 Samuel 6:14-16 says
And David danced before the Lord with all his might, clad in a linen ephod [a priest's upper garment].
15So David and all the house of Israel brought up the ark of the Lord with shouting and with the sound of the trumpet.
16As the ark of the Lord came into the City of David, Michal, Saul's daughter [David's wife], looked out of the window and saw King David leaping and dancing before the Lord, and she despised him in her heart.(Italics my own)
Based on verse 14 we see that indeed David was not naked but in his preistly garments. Later on when his wife confronts him we read that he stripped off his "kingly robes"
2 Samuel 6:20
Then David returned to bless his household. And [his wife] Michal daughter of Saul came out to meet David and said, How glorious was the king of Israel today, who stripped himself of his kingly robes and uncovered himself in the eyes of his servants' maids as one of the worthless fellows shamelessly uncovers himself! (italics mine)
It is very important to read the entire context of scripture.