The big difference between Denethor and the Company is actually not whether they have hope. Most of the company agree that it is unlikely that they will succeed.
Denethor is different because he loses hope, and decides to give up. Not only does he decide to kill himself - he is willing to bring down others who depend on him. He tries to kill Faramir. He gives up on the defense of Minas Tirith, and the people who rely on him.
Giving up hurts other people.