David asked God to spare him from a premature death in the company of the wicked. Evidently he expected God to judge the wicked this way, and wanted God to separate him from them in His judgment (cf. Genesis 18:23), as David had separated himself from them in his behavior. It appears that some people were grouping David together with others who were wicked in their thinking, but he did not want God to do that. [source][source][source]