Close the door.
That’s the simplest way. If the vacuum has mapping and room selection, you can tell it to clean just one room from the app. No virtual walls needed.
Most modern robot vacuums (Roomba, Roborock, Dreame, etc.) let you map your floor and then select individual rooms to clean. After a mapping run, you label each room in the app. Then you just pick the room and hit go. If your vacuum doesn’t have that feature, you’re stuck with either closing the door or using a physical barrier.
If the vacuum isn’t mapped yet, do a full mapping run first. Then set up no-go zones (invisible walls) inside the app for the rooms you don’t want touched. Same effect as virtual walls, but digital.
If your vacuum has no mapping at all—like an old Roomba 600 series—you’re out of luck. Get a piece of cardboard or a doorstop.
Final thought: A mapped vacuum is worth the upgrade if you clean per room more than once a week.