Looks like you have already made a ruling for that situation.
Of course, the creature you target with the Scry spell gets a Wisdom save to negate the spell, which bring up the question of "do you know when you are the target of a spell and have to make a save?"
Plus, unless the enemy is scrying on them while they are in a place the caster is personally familiar with, the Teleport spell will probably be using the "Viewed once - with magic" miss chance and is quite likely to land nowhere close to the party...
So if it was me, I'd probably roll initiative only if I determine that the teleporting bad guy will actually be landing on target - i.e. after the teleport spell is cast.
Thus the scry and teleport would be before combat, the surprise round would be AFTER the bad guy arrives, giving the bad guy a full turn after casting teleport...except that the PC's have magic that negates the surprise, so no surprise round and combat starts with everyone taking actions normally on their initiative.
I'm fairly sure that it works thus:
The enemy ambushes the party. The
AMBUSH happens regardless of any feats. The only way to avoid it is to notice the enemies laying in wait.
1 member of the party has a way to negate surprise. No one else does.
The enemy attacks, initiating combat. Roll initiative. The enemies are visible now, because they are
attacking because combat happens simultaneously.
5e has no surprise round, and rounds happen simultaneously.
The unsurprisable guy, and one other party member, go before the ambushers. What does this mean? It means they react instantly to the sight of the first attacker moving to attack,
before the attack mechanically happens. Thematically, the ambushers are just starting to move at this point.
Mr. No Surprise gets to act as normal, because his
reflexes are that good. He suffers no ill effect from being ambushed. He can't be subjected to the psuedo-paralysis known as Surprise.
Mr. Good Initiative gets...to use a bonus action, draw a weapon, and that's it. His reflexes are good, but not good enough to avoid the psuedo paralysis of Surprise.
Attackers go, getting full turns. Other party members go, getting their abbreviated turns. Next round, combat runs as normal.
There is no reason that declaring the teleportation would be what triggers initiative. It would be the moment the attackers begin to attack. WHich would mean they are already in the space, spells being intoned, arrows being drawn, whatever. If Dary the Rogue is Alert, and beats everyone else's init, he is so Alert and fast, that the moment the enemy begins intoning that attack spell, or pulling back that bow string, he is able to throw his daggerdaggerdagger, entirely unaffected by the ambush.