Probably the first thing to do is to have her vet checked to make sure there isn't a physical reason. The vet may have some ideas.
I would start with a crate. They won't poop in their crate most likely. Once you get her trained, you can remove the crate if you wish.
The other option is to set your clock and get up in the middle of the night and let her out.
I would crate train to begin with. The dog probably has some anxiety about her new surroundings and the crate may be comforting. All the dogs I have crate trained have loved their crate. They feel safe there.
Dale