You can't train a chicken to use a litter box or bark at the door when it needs to go outside to poop. Just the thought of "They poop where they please when the urge hits" is more than enough for me to never let one live in the house.
Yes, you can!
https://www.backyardchickens.com/t/392545/how-to-potty-train-your-chicken
https://www.backyardchickens.com/t/125001/potty-training-chickens-how-to
I have two chickens who aren't quite out of the brooder permanently yet (mainly because the coop is being 'renovated', for lack of a better term) and so they're inside with us/ in the brooder from about 6pm until whenever we wake up the next day, since the brooder is in the garage (the garage being connected to our room, we're in a bottom-half-of-the-house-granny-flat sort of situation) . However, because I want them really used to us, we often just let them sit out of their brooder and with us in the main living area. We basically raised them like regular birds, handled them and had them with us during every day household activities, they like to use my arms/shoulders as roosts while I'm watching TV etc. Have to say, the cat isn't entirely impressed about this set-up, but she deals.
Once they're out in the coop full time, they'll probably stay out of the house for good though.
I don't really see how it could be as unsanitary as some people seem to make it out to be, because a chicken is just as clean as the owner allows it to be. If you don't clean up after it and keep its feet clean/dry etc, then sure, it's not going to be very sanitary but that's then your own fault. We're used to keeping a very clean household because I recently underwent a lengthy medical/surgical process in which I had basically open wounds throughout my bottom right leg for the past nine months and couldn't risk any chance of infection the entire time, so although we don't have to anymore, we're just used to sweeping every day, mopping once a week and basically disinfecting everything and making sure everything is clean. But, y'know, if you're not as routine with cleaning, then you probably shouldn't keep it in the house. It's easier for us too, because if they do happen to make a bit of a mess, we have tiled floors throughout and can clean it straight up and our apartment is well ventilated.
I definitely don't think you should keep them in the house all the time though, they're animals. They should be free to eat grass and feel the sun and the breeze and that sort of thing.