Cartola, what your little guy is doing is challenging your leadership. Dogs within a pack that decide they want to be the leader start by showing the current leader disrespect. Pooping or peeing in the place they sleep where the leader's scent is the strongest is normal. The challenges will continue to escalate if the leader doesn't squash it and put the challenger in his place. So, you are probably sending mixed signals to your dog without realizing it. Dogs view the world around them differently than we do. There are certain things they expect their leaders to do. So, you need to change how you handle situations with your dog to show him that you are the boss and completely extinguish any attempts he may make to take over your job as the leader of the pack. This is a link that both labman and I use:
Establishing and Keeping Alpha Position, Letting your dog know you are the boss Start following those training guidelines when dealing with your dog. If you have any questions or are having problems with application of any of these steps, post back and I will do my best to help you.
I do understand the desire that people have to allow their dogs onto the couch or bed. If you do this and want to continue allowing your dog to sleep or sit with you, there are steps you need to take to keep your leadership position. When you are planning on sitting down on the couch, ensure the dog doesn't jump up first to "claim" his spot, by making him sit down and stay until you, the leader, claim your spot. If he is already on the couch don't just sit down next to him, but shoo him off, make him sit and stay, and then claim your spot before inviting him to come up and join you. Do the same thing with the bed. Make him get off, sit/stay, claim your spot, then invite him up.
Never allow your dog to be in a position on the bed any higher than your chest level. If he likes to sit or sleep next to your head or at the top of the bed, he is telling you that he thinks he is above you in rank. Dogs recognize the one sitting up higher or claiming the primo comfy spot first, is the alpha dog. So,
you need to ensure he is always physically at a lower level than you no matter where you are. After a while, your dog will automatically jump off the couch or bed when he sees you coming and will sit and stay until you claim your spot. If during the night, he starts to move upward past your chest level area, you need to quickly direct him back down to the area you have allowed him to sleep with a "no", "lie down", and "stay". Until he eventually gets this retraining, you are going to have to keep correcting him.
Consistency in all your training is the key.
Once you entrench yourself as the leader by following the steps in that link I provided and you incorporate the furniture instructions that I have laid out here, you will find that your dog will be very eager to following whatever directions/commands you give to him. Dogs always follow their leader and are very happy to do so. Very few dogs are born with the leader (alpha) gene firmly in place. They want to have a strong leader to follow so it takes the pressure off them. To a dog, being a leader is hard work and there is always the fear that someone will challenge them and they will have to defend their position and get into a fight over it. It is a lot of pressure and most dogs don't want it.
Cartola, there is one other thing I should mention. If your dog is not neutered, you should seriously consider getting this done. Neutering has a tendency to reduce any aggressive tendencies a male might have. Your dog pooping on your bed is a form of aggression that is being directed toward you. The other good thing about neutering, besides avoiding unwanted pregnancies, is that you won't have to worry about him developing testicular cancer down the road.