$\begin{bmatrix} X_{1} &X_{2} & X_{3} &Y_{1} \\ X_{4}& X_{5} & X_{6} & Y_{2}\\ X_{7} & X_{8}& a& b\\ Y_{3} &Y_{4} &c & d \end{bmatrix}$
Now in this matrix, $X_{1} ... X_{8}$ can be chosen arbitrarily. When you have chosen these 8 independent elements, $Y_{1}.... Y_{4}$ are automatically fixed because row sum and column sum constrains has to be maintained. Now I will prove that $a$,$b$,$c$ and $d$ are also fixed so the rank of the vector space is 8(number of independently chosen elements).
The given four equations i.e.
$a + b = F- X_{7}- X_{8}$
$a+ c= F- X_{3}- X_{6}$
$b + d = F- Y_{1}- Y_{2}$
$c + d = F- Y_{3}- Y_{4}$
have to be satisfied. and these are 4 independent equations in 4 unknowns. So can be solved uniquely which means a,b,c,d are also fixed. Here $F$ is the fixed row sum or column sum.
Hence $X_{i}$ are the only free elements. so the dimension is 8.