Not every shrine you encounter in Nioh 2 will allow you to rest at it. Forces will have defiled some of them you encounter during your journey, and to properly use them again to save and level up your character, you need to purify it.
You do not require an item or any special spell to purify the shrine. All you need to do is locate the enemy that is defiling the shrine, and defeat them. It’s usually a powerful enemy guarding it. When you defeat them, the area around you should change, and you should be able to return to the shrine to pray at it, as you traditionally would.
After defeating the enemy, they should vanish from the game, so you don’t have to fight them over and over again repeatedly. The strength of the enemy will vary your distance in the game, but most of the time, they’re powerful spirits you need to banish. The first one, for example, is an Enki, the giant ape-like demons with spears. When you defeat it, the environment around you should return to normal, and you can freely move about with any disadvantages to your ki recharging.