We present several rigidity results for Riemannian manifolds (M, g) with scalar curvature S >= - n(n - 1) (or S >= 0), and having compact boundary N satisfying a related mean curvature inequality. The proofs make use of results on marginally outer trapped surfaces applied to appropriate initial data sets. One of the results involves an analysis of Obata's equation on manifolds with boundary. This result is relevant to recent work of Lan-Hsuan Huang and the second author concerning the rigidity of asymptotically locally hyperbolic manifolds with zero mass.