Let me formulate the problem this way:
Vector space \ V_1 contains \ n_1 linearly indipendent vectors.Hence the basis set is:
\ B_1 = {|\ u_1>,|\ u_2>, |\ u_3>...|\ u_i>,...|\ u_k>,...|\ u_n1>}
Similarly,vector space \ V_2 contains \ n_2 linearly indipendent vectors. Hence, the basis set is:
\ B_2 = {|\ v_1>,|\ v_2>, |\ v_3>...|\ v_p>,...|\ v_r>,...|\ v_n2>}
Given:
<\ u_i|\ u_k>=0......A [for all i,j,k in the set [1,2,...,n1]]
<\ v_p|\ v_r>=0......B [for all p,q,r in the set [1,2,...,n2]]
Additionally, <\ u_i|\ v_p>=0...C [for all i,j,k,...p,q,r]
Let us consider the set:
\ B'={|\ u_1>,|\ u_2>,...|\ u_n1,|\ v_1>,|\ v_2>,...|\ v_n2>}
containing \ n_1+\ n_2 linearly indipendent vectors.
The basis set \ B for the vector space \ Vwill be a subset of this.The number of elements in the set \ B will be less than or equal to \ n_1+\ n_2 depending on whether all the \ n_1 vectors in \ B_1 are orthogonal to all \ n_2 vectors in \ B_2.
Since,we have C satisfied by all \ u_i and \ v_p,
\ B=\ B_1 \ U \ B_2 has all distinct elements because of A,B and C.So, there are total \ n_1+\ n_2 elements.All of them are linearly indipendent of each other. And they are therefore, a good choice of basis of the vector space V.
Hence, the vector space V is spanned by \ n_1+\ n_2 vectors.No more,no less.Insertion of any non-trivial extra element in \ B' will result in \ n_1+\n_2+\1 vectors and the set of vectors will be lineraly dependent.
With our choice, \ B=\ B'.Any vector in vector space V can be written as a linear combination of those \ n_1+\ n_2 vectors in \ B.So, the dimension of the vector space \ V will be \ n_1+\ n_2