The bell rings, the dog loses its mind, the guest is nervous before they are through the door, and somebody suggests locking the dog in a room -- which teaches it nothing and makes the next visit worse.
What has actually worked for people:
- Desensitising the bell itself by ringing it twenty times a day when nobody is at the door until it stops meaning anything
- Teaching a "place" -- a mat the dog goes to and is rewarded on when the bell goes
- Having the guest ignore the dog completely for the first few minutes
- Removing the reward: the door does not open until the barking stops
What did not work is also useful to know. Shouting at a barking dog reads to the dog as joining in.
Tell us what your dog does, how old it is, and what you have tried.