Yes. The application of Bernoulli does not depend on the boundary conditions. It is possible to devise both constrained and unconstrained problems that will obey Bernoulli well.
However, the accuracy
does depend on the boundary conditions because viscosity effects are typically confined to the boundaries of a flow. Since Bernoulli assumes that the flow is inviscid and laminar, any flow that is significantly viscous or at all turbulent will not be predicted well by Bernoulli's equation.