Let $M^3$ be a compact, connected and orientable manifold with boundary. I will say that $M$ is weakly irreducible if every smoothly embedded $2$-sphere $S \subset \operatorname{int}(M)$ separates $M$, or equivalently, if it determines the zero class in $H_2(M, \partial M;\mathbb{Z})$.
Trivial examples are manifolds for which $H_2(M, \partial M;\mathbb{Z}) = 0$ or even $H_2(M;\mathbb{Z}) = 0$. I would like to know examples of weakly irreducible $3$-manifolds with nonzero second homology groups.
Added: as @MoisheKohan said, it would also be nice to have examples of reducible $3$-manifolds which are also weakly irreducible.
Let $M_1,...,M_n$ ($n\ge 2$) be closed connected orientable irreducible 3-manifolds, none of which is $S^3$. Then their connected sum $$ M=M_1\# ... \# M_n $$ is weakly irreducible (but reducible). The "reducible" part, I assume, is clear. To see that $M$ is weakly irreducible, first observe that the above is a prime decomposition of $M$ since each $M_i$ was assumed to be irreducible.
Suppose to the contrary that $M$ contains a non-separating sphere $\Sigma$. Let $c\subset M$ be a smooth simple loop crossing $\Sigma$ transversally at one point. Taking a regular neighborhood of $\Sigma\cup c$ we obtain $S^2\times S^1$ with a 3-ball removed. Thus, $M$ is homeomorphic to $S^2\times S^1 \# N$ for some $N$. The uniqueness of connected summands in a connected sum decomposition of oriented 3-manifolds implies that one of the manifolds $M_i$ is $S^2\times S^1$, contradicting our assumption that each $M_i$ is irreducible.
Conversely, every orientable connected weakly irreducible but reducible, closed 3-manifold has this form. The proof is similar to the argument I just gave: Take the prime decomposition of $M$. Among the prime factors $M_i$ none can be $S^2\times S^1$ (since the latter is weakly reducible). Thus, each $M_i$ is irreducible. ($S^2\times S^1$ is the only closed prime oriented 3-manifolds which is not irreducible.)
Of course, if you want to have examples with nontrivial relative $H_2$, just take one of the connected summands to satisfy this property.