Vaccination and post-exposure immunization against the human immunodeficiency viruses (HIV-1 and HIV-2) faces the problem of the extensive genetic and antigenic variability of these viruses. This raises the question of what fraction of all possible antigen strains of the virus must be recognized by the immune response to a vaccine to prevent development of acquired immunodeficiency disease (AIDS). The success of a vaccine can depend on the variability of the target epitopes. The different HIV variants must be suppressed faster than new escape mutants can be produced. In this paper the antigenic variation of HIV during an individual infection is described by a stochastic process. The central assumption is that antigenic drift is important for the virus to survive immunological attack and to establish a persistent infection that leads to the development of AIDS after a long incubation period. The mathematical analysis reveals that the fraction of antigenic variants recognized by the immune response, that is induced by a successful immunogen, must exceed 1 - 1/R, where R is the diversification rate of the virus population. This means that if each HIV strain can produce, on average, five new escape mutants, then more than 80% of the possible variants must be covered by the immunogen. A generic result of the model is that, no matter how immunogenic a vaccine is, it will fail if it does not enhance immune attack against a sufficiently large fraction of strains. Furthermore, it is shown that the timing of the application of post-exposure immunization is important.