You should NOT discipline or punish him for doing something like speaking.
THIS IS THE AGE they do this...it is purely developmental based. It is NOT something personal against you, that he is doing this. HE is the child, not you. There is NO need to take his "words" personally or get angry about it, at him.
It's just the flavor of the month... next, it will be another 'favorite' word.
If you don't like him saying the word "no"...then teach him to say an alternative. Like...'Okay', or 'not now', or 'later' or 'maybe' or just something else. Then that way, you will also be building his vocabulary. When my daughter was 2 years old... I taught her the word "compromise"...as an alternative word she could say for when she is frustrated. It really worked and that was a productive word for her, and us. Never talk down or assume a child cannot learn these words...my daughter had this kind of vocabulary from 2 years old, because it's all I taught her. A child can learn other words and definitions... we just have to show them.
BE thankful, that your son CAN talk, and is doing it age appropriately. It is a PHASE. It Will stop. Just not yet.
If you punish him for every little word or phrase "you" don't like, then you will be teaching him that he should NOT talk, nor express himself, nor to be "able" to tell you things, nor to feel comfortable doing it... he will only feel self-conscious about talking to you, and will hesitate. This is not normal or good for a child.
Put it this way- my son is delayed in speaking. He is now 28 months old, and he works with a Speech Therapist. My son... at his current age, NOW SAYS "NO" to us and the whole world. WE ARE VERY HAPPY THAT HE IS SPEAKING... AND SAYING 'NO' TO US AND SO PROUD OF HIM! My son says 'no' ALL the time... so what. We are not bothered by it, we don't take it personally, we don't mind, and he is so proud of himself...and he is saying more words and sentences now. HOW FANTASTIC!
So, that is the other way to look at it. Seeing what the other side of the fence looks like. Seeing how something as easy as saying 'no'...can be a fantastic, lovely word for a child to say and for a Parent to hear.
Now, of course our son says 'no' a LOT too.... but, to us and our perspective, we are happy about it because he is "asserting" himself, he is finding his sense of self, he is being independent, he is telling others about his 'boundaries', he is expressing himself. Plain and simple. We LOVE that he is doing this. If he says it too loudly... we simply tell him "don't yell..." and then he makes his voice softer. No problem.
ALSO keep in mind, that a child this age does NOT have FULL impulse control, nor do they have total control over their reactions. They at this age, are a "reactor." And this is what they do, and how they learn. IN TIME... a child will learn. They have their entire childhoods, to become the children WE want them to be....or the child they are yearning to be. Even a teenager will say "no" to us and others.... and in increased frequency. SO... what then? Even if you teach your son to NOT say "no".....he will at 2 years old, then at 3 years old, then at 4 years old, then as a Teenager... and so forth.
It's just one of many words and feelings and emotions that are developing now. A toddler is not even FULLY developed in terms of emotions either. It is a process.
One day, he will be fine about the word. It's a phase.
All the best,
Susan