Our work proves rigidity theorems for initial data sets associated with compact smooth spin manifolds with boundary and with compact convex polytopes, subject to the dominant energy condition. For manifolds with smooth boundary, this is based on the solution of a boundary value problem for Dirac operators. For convex polytopes we use approximations by manifolds with smooth boundary.