In the Harry Potter continuum, Occlumency is the art of magically shielding one's mind from invasion by Legilimency. It can prevent a Legilimens from accessing or influencing one's thoughts and feelings. A practitioner is known as an Occlumens.
Occlumency takes a great deal of mental and emotional discipline to perform. In its most basic form, the practitioner must make their mind totally blank, preventing an invading Legilimens from picking up any of their thoughts and feelings. A very skilled Occlumens can hide or reveal precisely what they wish according to what they want the Legilimens to believe.
Severus Snape is a highly skilled Occlumens, which allows him to spy on Lord Voldemort, a highly skilled Legilimens.