Know the 'rules'... dogs need to toilet after eating/drinking, when they wake up and after playing.... and it is about you being consistant.
As you have failed, you are either not being consistant, not watching the dog carefully for the 3-5 weeks it takes to train toilet training, making too much of it, in either talking too much and confusing the dog or getting your command timing wrong
So you need to start again and do it a different way. Lindas suggestion of crating while you are not watching is a good one, but if you haven't crate trained then that can cause the dog stress, however you do need to reduce its space, either in one small room with an easy to clean floor and follow the 'rules'. Clip a lead onto the dog and let it trail, that way you can SILENTLY step on the lead/pick up the lead and walk outside without speaking and stand silently outside, just drop the lead once outside and let the dog sniff and hopefully pee/poo as it is DOING it that is when you speak, ONE command word ( I use 'clean' but you can choose any command word) and you only say that word when the dog is actually toileting.
If the dog doesn't 'go' after 5-10 mins then go in, restrict the dogs space and try again 10-15 mins later....all this is in silence. Once the dog learns the command word you can open the door and let the dog out on its own and tell it to 'be clean' so you then know your dog will toilet on command.
The idea of training ANYTHING is to get the ACTION and only then use the command word so the dog associates that action with that command word