Most cats understand how to use a litter box when they see one, but some cats may need to be trained. Yet other cats will happily use a litter box and then suddenly avoid it. One possible reason is that your cat is simply being a jerk and doing what cats do best, which is to annoy their human owners.
Another reason is that cats may experience pain urinating or defecating and blame the litter box, so from that point on, they avoid using it. So if your cat is avoiding the litter box, perhaps you need to cater to its whims even more than normal just to let the cat know that the feline is really in charge of your relationship.