Consider an N by N matrix with all main-diagonal elements negative, all off-diagonal elements non-negative, and the sum of all N columns equal to a zero vector. Clearly, the rank of the matrix is less than N; how does one prove that it is exactly N-1?
In view of the comments below, I have to add the following condition: visualize a graph with N nodes and our N by N matrix indicating which of these are adjacent (when the matrix has a non-zero value) and which are not (zero value). Consider only matrices resulting in a connected graph.
Subsidiary (an easier question): how would the proof go if all off-diagonal elements were required to be positive?
As pointed out by the Answer below, rather than messing up with graphs, the extra condition can be simply stated as being irreducible.
As pointed out in a comment, your claim cannot be universally true: if it is true for some matrix $A$, it will be false for $A\oplus A$.
It is true, however, if your matrix is irreducible (i.e., if it is not similar, via any permutation matrix, to a block triangular matrix). Call your matrix $A$. Let $B=kI-A$ where $k>0$ is sufficiently large, so that $B$ is entrywise non-negative. It is also irreducible because $A$ is irreducible. Therefore $\rho(B)$ is a simple eigenvalue of $B$, by Perron-Frobenius theorem. However, since $\mathbf1^TB=\mathbf1^T(kI-A)=k\mathbf1^T$, $\mathbf1$ is a positive left eigenvector of $B$ corresponding to the eigenvalue $k$. Hence $k$ is necessarily equal to $\rho(B)$. In turn, $k-\rho(B)=0$ is a simple eigenvalue of $A=kI-B$, meaning that the nullity of $A$ is $1$.