Said rogue would definately be flanking the entire time, as long as he was threatening with that dagger. He fighter buddy would get the +2 to hit and everything. However, since a wand is not a melee attack, the rogue would not benefit of flanking while using it.
True, he doesn't get a +2 bonus on attack if he makes a ranged attack, since it is not a melee attack, but does he get the other benefits of flanking? I.e. sneak attack and other abilities which might rely on flanking in order to occur.
Do you threaten a square with a ranged weapon (not using it as a melee weapon)?
If you do not - and there is no text supporting the stance that you do indeed threaten with a ranged weapon - then you can provide no benefit to your ally who is melee even if you are on the opposite side of the foe as he is.
In order to receive a flanking bonus, you do not need to threaten your opponent. Your ally, standing on the opposite side of your opponent from you, must threaten as you make a melee attack in order for you to receive a flanking bonus. If your ally is providing you with a flanking bonus, can you be considered flanking if you do not take that flanking bonus, because for whatever reason you do not make a melee attack on your turn -- you drink a potion, choose the total defense option, aid another, make an unarmed attack, make a ranged attack, etc.
To me, the argument hinges on the underlying assumption that there is a state of
flanking -- which the rules apparently define according to a line test -- that is separate from the
flanking bonus. Can you be considered flanking even if you do not take the flanking bonus you would ordinarily receive had you made a melee attack?
This assumption allows four properly placed allies to flank two formians, ambush drakes or axiomatic creatures. Those creatures have a special quality that says that no such creature in the group "is considered flanked unless all of them are." This implies that it is possible for them all to be considered flanked at the same time, which isn't possible if you are only flanking when you receive the flanking bonus. Why? Because the way initiative works, each character gets an attack one at a time, so the formians can never be flanked all at the same time, only as each character gets an attack, thus one at a time. In that case, the formian's hive mind special quality should state "formians cannot be flanked."