This short scene serves an interlude between Act 3 when Hamlet kills Polonius and talks at length with his mother and Act 4 when Hamlet will be confronted about the death of Polonius and sent off the England. In this scene, Rosencrantz and Guildenstern have been sent by the King to find Hamlet and get from him the location of Polonius's dead body which we last saw when Hamlet was dragging it from his mother's room.
When the two friends ask him where Polonius's body is, Hamlet only responds in riddles, which they take as further indication of Hamlet's madness. He first replies that it is "compounded with dust." This is an ironic comment because Hamlet has literally stowed it in a presumable dusty closet under the stair, but he is also suggesting the religious allusion that a body comes from ashes and returns to ashes or dust after death. (Ashes to ashes -- dust to dust.)
When Rosencrantz and Guildenstern ask again where the body is, he says, "the body is with the King, but the King is not with body." With the first reference to King he is speaking of his dead father King Hamlet -- Polonius is with him in death now. The second reference to King, is King Claudius whom Polonius is NOT with because he is dead and hidden under the stairs. Hamlet is trying to make the two friends look like fools, and with his ironic comments he is doing a fine job.