The particle deficiency problem in the presence of a rigid wall for smoothed particle hydrodynamics (SPH) is considered. The problem arises from insufficient information being available to perform accurate interpolation of data at particles located nearer to the boundary than the support of the interpolation kernel. The standard method for overcoming this problem is based on the introduction of image particles to populate the deficient regions and the use of linear extrapolation to determine the velocity of these image particles from that of fluid particles. A consistent treatment of boundary conditions, utilising the momentum equation to obtain approximations to the velocity of image particles, is described. The method ensures second order approximation of the boundary conditions. It is validated for Poiseuille and Couette flow, for which analytical series solutions exist and shows second order convergence under certain conditions.