Every dog is going to have a confinement zone (your house or room is one even if you don't use a crate/pen/gate etc.). Dogs don't have thumbs to open the doors and leave the house! It is imperative that we make the confinement zone a good place to be so the dog doesn't develop any separation anxiety, or isolation issues. When a dog is already struggling with separation anxiety, this is 100x more important!
Trainers usually advise owners with young dogs to have a short-term confinement area and long-term area. The short term is when you can't watch the puppy, but you are home. This could be an x-pen, gated kitchen or crate. The long-term for some people, may be the same place, but for others it may be a dog run, yard, garage, expanded pen with crate attached.
When choosing this area, it should be an area that is SAFE above all. Know your dog. Is your dog a chewer? A gated bathroom or closed laundry room is a bad idea for a chewer! A chewing dog is going to need "walls" that are chew-safe like a crate, pen, dog run etc. Is your dog fearful? A barker? Extremely small? Being left outdoors is not for dogs that are nervous, barky or small enough to be taken by a bird of prey. Is the dog an escape artist? A jumper? X-pen won't work then! Best for that type of dog to use a crate or enclosed dog run.
Once you have determined the best area for YOUR dog, then you must set to work making it a great place to be. A small number of dogs may take to a new area without any work, but those are the minority.
Step 1: Spend time with your dog in this space (if it is a crate, you will be near it with door open). Go in the space and do what your dog likes to do: pets, tug fetch, belly rubs.
Step 2: All good things should come from this space. Meals, bones, new toys. Put the "stuff" in the space and leave the exit open. Bonus points if you can affix a stuffed kong to the rail/side so the dog has to stay in to work on it.
Step 3: Play "crate games" with the space, even if it isn't the crate. Crate games can be youtubed or I can provide you with the directions if we are working together. This is a desensitizing program with counter conditioning.
Step 4: Use the space! Some dogs may only need you to follow the steps for a few days and be totally fine. Dogs with separation anxiety on a set protocol will need more gentle care and do the steps for weeks before working up to being left in the space for real departures. Don't poison the new space by leaving your SA dog in it before they are ready!