easiest way is a focus macro where you check if the toon you want to focus is alive.
if not the macro continues until it has found a living toon =)

then assist the focus

but the main problem most people ignore is:

I use my focus function for polymorph + re-polymorph during a combat
so I can't use focus + assist-focus

creating big /assist if nodead macros which checks each toon are too long
for the macro function of WoW so I only check two toons:

assist tank if alive, if not assist priest, if both are dead do nothing and just die