Solution (source code)

= Solution

Use the usual connected-manifold convention for this assertion. Suppose, for contradiction, that $H^2(M,\mathcal O_M)=0$. The <Dolbeault theorem> gives $H^{0,2}=0$, and the <Hodge decomposition theorem for compact Kähler manifolds> and its conjugation symmetry give $H^{2,0}=0$. Hence every real class in $H^2(M,\mathbb R)$ has a real <harmonic differential form> of type $(1,1)$ as its representative.

The <intersection form> is $Q([u],[v])=\int_Mu\wedge v$. Its value on the Kähler class is positive: $Q([\omega],[\omega])=\int_M\omega^2>0$. Every real harmonic $(1,1)$ form splits uniquely as $c\omega+u_0$, with $u_0$ primitive and $c$ constant. Indeed, $\Lambda u$ is a <harmonic function>, hence constant by <connectedness>, and $\Lambda\omega=2$; subtracting $c\omega$ kills $\Lambda u$, and part (b) makes $u_0$ primitive.

Part (c) gives $*u_0=-u_0$, while $\omega\wedge u_0=0$. Thus
$$
Q([\omega],[u_0])=0,\qquad Q([u_0],[u_0])=-\|u_0\|_{L^2}^2<0\quad(u_0\ne0).
$$
This proves the <Hodge index theorem for compact Kähler surfaces> in this case: $Q$ has <signature> $(1,b_2-1)$.

On the alleged two-dimensional <totally isotropic subspace> $V$, the <linear functional> $v\mapsto Q(v,[\omega])$ has a nonzero vector in its <kernel>. Its <harmonic differential form> representative is primitive, so the preceding negative-definiteness statement gives $Q(v,v)<0$, contradicting the vanishing of $Q$ on $V$. Therefore
$$
\boxed{\dim_{\mathbb R}V=2,\quad Q|_{V\otimes V}=0\ \Longrightarrow\ H^2(M,\mathcal O_M)\ne0.}
$$
<Connectedness> is essential if one's definition of a manifold allows disconnected spaces. For $M=Y\sqcup Y$, with $Y=\mathbb{CP}^1\times\mathbb{CP}^1$, one has $H^2(M,\mathcal O_M)=0$. Take on each component the pullback of the degree-two class from its first factor. Each class has square zero, and their mutual pairing is zero because their supports lie on different components. Their span is then a two-dimensional <totally isotropic subspace>, disproving the unqualified disconnected version.