The form and the intended meaning work together.
لَا تَقْنَطُوا مِنْ رَحْمَةِ اللَّهِ
Do not despair of Allah's mercy.
The final وا shows a masculine plural form after removal of inflectional nūn. The context clearly tells the group not to do an action, so لَا is prohibitive rather than merely negative.