A well-drafted will should always take into account what should happen if one or more of the beneficiaries dies before the testator. However if there are no such provisions written into the will, the will as a whole isn't invalidated.
If the deceased beneficiary was the son or daughter of the testator, and they had children, then the gift to the son or daughter passes (in equal shares) to their children.
Otherwise any gift that can longer go to a named beneficiary (because they're deceased) goes into the pot for the 'residuary beneficiary' (if any) who gets everything that's not otherwise assigned by the will.
If there is no residuary beneficiary (or he/she predeceases the testator) then a 'partial intestacy' is created and that part of the estate which remains unassigned is dealt with under the same rules that would have applied if the testator had not left a will.