Your cat is not going in the box or they are having trouble when in the box? This is a common and frustrating problem.
The first step for this is to visit your vet at the first signs of trouble. Letting this one go can make it harder to tell if it is a medical problem or a behavioral problem. Your vet will look into the medical side first and try to find any sources of trouble that can make your cat need to go more urgently or frequently. Before you go, it is important to think through the problem a little so you can give your vet some hints.
Is the problem urination or defecation? Do they seem to be going more often? Are they straining to go, crying when visiting the box, hiding, or is their blood involved? Has there been a change in their life recently like company, your vacation, construction or a new pet?
Cats will frequently respond to stress with medical issues involving trouble urinating. If the problem is with defecation, make sure to bring a fresh sample of poop (at least a teaspoon but preferably a tablespoon) with a little litter as possible involved.
This can easily be a combined problem where the trouble starts medically and quickly becomes a behavior that they continue after the medical problem has improved. If you suspect there is a behavioral component, it is important for the humans and cats to revisit litterbox basics and try to get the situation under control.
Look back to the basic litter box requirements in litter box article on this site and make sure you are meeting this. Even if your cat never previously needed to have the perfect set up of multiple litter boxes on each floor, you should consider doing this to try and get the household back on track.
If you need to isolate your cat to a smaller area of the house, like a bathroom, to get them back in the habit of using the litter box you will want to make sure that it does not contain rugs, clothing piles or plants that may be mistaken for a more appealing spot than the box.
Provide food, water, and small comfort items. Make sure to spend quality time with the isolated pet and try to make the experience as low in stress as possible.
Slowly allow them to start supervised time outside the small area once they have reestablished the habit. Ideally, they will continue to use the boxes once they have practiced in a smaller setting.
You should clean the area where your cat went outside the box as best as possible because they will be attracted to this area in the future. Some folks just put a litterbox where the pet has decided to go inappropriately, then slowly move it to a more desirable location. This is not always possible but has helped on occasions where the pet has not been able to get their mind off a specific spot they have marked in the past.
Your vet will likely have some suggestions on behavior help as well. They may suggest medication. These are just some basics that may help them to move through a consult more efficiently to find the most helpful advice for your household.