The overall function of Psalm 16 is hard to determine, in part because the Hebrew text of verses 2–4 is difficult, but it appears to be a psalm of trust or more particularly a confession of faith in and loyalty to Yahweh.
16:1–4 It opens with a general petition for protection in the image of refuge. Verses 2–4 probably act as a report (I said) of the worshiper’s confession declaring, “You are my Lord,” as distinct from other gods. He resolves that Yahweh will be his sole source for good. This loyalty is further spelled out by a refusal to participate in pagan rituals (libations of blood and taking up their names on my lips). Hosea 2:17 may provide a parallel here: “I will remove the names of the Baals from her lips.” Baal was considered by many to be the god of the land of Canaan, so in t…