I can't figure out how to write the following condition to an LP.
I have four nonnegative variables: $X_A$, $X_B$, $X_C$, and $X_D$.
The condition which should be satisfied is this:
If $X_A$ and $X_B$ have positive coefficients in the optimal solution then, $X_C$ shoud have $0$ coefficient in the optimum.
I guess, I should introduce binary variables, but I'm not sure how.
Use binary variables $y_A$ and $y_B$ that equal $1$ if and only if $X_A$ and $X_B$ are strictly positive (respectively).
Then add the following constraints to your LP: \begin{align*} &X_A\le M\,y_A\\ &X_B\le M\,y_B\\ &X_C\le M\,(2-y_A-y_B) \end{align*}
M is a large constant. The first two constraints activate the binary variables $y_A$ and $y_B$ if $x_A$ and $x_B$ are strictly positive. The last constraint ensures what you want: if $X_A$ and $X_B$ are strictly positive, then $y_A=y_B=1$, and the right hand term equals $0$, imposing $X_C=0$.