Pure Incense is an item to be held by a pokemon that can be obtained by defeating boss pokemon. If it is held by the pokemon at the front of your party, it repels pokemon that are a lower level than the pokemon that is holding the Pure Incense.
It does NOT help repel pokemon if the pokemon holding the Pure Incense is not at the front of the party, even if the first pokemon has fainted. It DOES work if the pokemon at the front of the party has fainted but is still holding the Pure Incense.
Note that Pure Incense does not repel all pokemon from attacking you. It only reduces the possibility of entering a wild pokemon battle.
The Pure Incense does not affect player-entered battles.