Occlumency was the act of magically closing the mind against intrusion by Legilimency. Severus Snape attempted to teach Harry Potter how to close his mind to Voldemort but the lessons were fraught and Harry found it hard to completely clear his mind and prevent Snape from using Legilimency to access his thoughts.