I do not sit with men of falsehood,
nor do I consort with hypocrites.
I hate the assembly of evildoers,
and I will not sit with the wicked. Psalm 26.4-5
In the first three verses David tells us about what he has given himself to, things like integrity and trust. In these next verses he tells us about what he keeps away from. He stays away from certain kinds of people: liars, hypocrites, those who give themselves to doing evil and then, the final catch-all, the wicked. And bear in mind that these words are not limited to 'those nasty people over there'. There are plenty of nice, moral and religious folk who also qualify. Think: Pharisees.
Here's the point. David is very aware of who it is he spends time with. And there are certain kinds of people he avoids. And he talks about this in the context of his comments about his integrity and such. There are people to be avoided.
And yet, consider other places in Scripture. Paul wrote that we aren't able to completely avoid certain kinds of people - nor should we try to.
I wrote to you in my letter not to associate with sexually immoral people - not at all meaning the sexually immoral of this world, or the greedy and swindlers, or idolaters, since then you would need to go out of the world.
And, of course, Jesus goes further. He purposely spent time with certain kinds of people. Remember that one of the complaints against Him was the He welcomed 'tax collectors and sinners'.
In light of these other bits of Bible, what do we do with David's words in our Psalm?
Knowing those other Scriptures actually helps us to understand David. For one thing, we are not to become some reclusive group with as little contact with the world as possible. And yet, we need to be aware that there is the danger of people tempting us away from being as faithful as we might which is David's concern. Not all unbelievers pose a threat like this. But some do. So, we need to be careful. There are some people we are to avoid. Some of us can handle certain kinds of people and situations better than others of us. But we all need to be careful.
This is especially the case for the children. Being younger, they are not as discerning about the character of some of their friends. They can't tell who is dangerous and who isn't. Their being under the influence of some is especially dangerous. Parents need to know who their children are with. This includes playmates, friends they hang out with and classmates. While we are generally to be open and welcoming to all, there are some people that we and our children need to avoid.