  We consider a general class of approximations which guarantees the
conservation of particle number in many-body perturbation theory. To do this we
extend the concept of $\Phi$-derivability for the self-energy $\Sigma$ to a
larger class of diagrammatic terms in which only some of the Green's function
lines contain the fully dressed Green's function $G$. We call the corresponding
approximations for $\Sigma$ partially $\Phi$-derivable. A special subclass of
such approximations, which are gauge-invariant, is obtained by dressing loops
in the diagrammatic expansion of $\Phi$ consistently with $G$. These
approximations are number conserving but do not have to fulfill other
conservation laws, such as the conservation of energy and momentum. From our
formalism we can easily deduce if commonly used approximations will fulfill the
continuity equation, which implies particle number conservation. We further
show how the concept of partial $\Phi$-derivability plays an important role in
the derivation of a generalized sum rule for the particle number, which reduces
to the Luttinger-Ward theorem in the case of a homogeneous electron gas, and
the Friedel sum rule in the case of the Anderson model. To do this we need to
ensure that the Green's function has certain complex analytic properties, which
can be guaranteed if the spectral function is positive semi-definite.The latter
property can be ensured for a subset of partially $\Phi$-derivable
approximations for the self-energy, namely those that can be constructed from
squares of so-called half-diagrams. In case the analytic requirements are not
fulfilled we highlight a number of subtle issues related to branch cuts, pole
structure and multi-valuedness. We also show that various schemes of computing
the particle number are consistent for particle number conserving
approximations.
