Hiding behind a wall
If you have partial cover, you may use Stealth. If you have total cover (wall is taller than you, or floor-to-ceiling, or whatever), you don’t even need Stealth. So you may hide behind a wall.
Readying an attack
You may then ready an attack for when he enters a square next to you, since an Attack Action may be done as a Standard and you are allowed to ready those. Your DM may require that you specify which square; the rules leave it up to the DM how specific you have to be. In any event, if this readied action is triggered, however specific your DM requires it to be, you then attack the target.
Sneak Attack?
The most recent errata gives you Total Concealment until after you make an attack. So what does that give you? Well, it means he doesn’t know what square you’re in and takes a 50% miss chance even if he guesses the right square. Does that let you Sneak Attack?
No. It does not. Sneaking does not actually let you Sneak Attack.
Commentary on this errata seems to indicate that the point of the errata was to allow rogues to Sneak Attack while, ya know, sneaking, but that doesn’t actually seem borne out by the rules.
So the rules don’t actually give you a Sneak Attack, even though you are considered “hidden” for that first attack (the one you readied). If your DM is sane, he’ll allow sneaking to trigger Sneak Attacks, because it’s ridiculous that the rules don’t allow it. Paizo’s lead dev has even stated (if you go digging through the forums) that it’s supposed to work; why he doesn’t just fix the rules is anyone’s guess, but there it is. Ultimately, this is something you’ll have to ask your DM about.
Does this sound flawed...or brilliant?
Considering that it doesn’t work, quite flawed, but even if we assume it’s allowed to work, it’s still pretty poor damage most of the time. Rogues tend to have very little combat presence at mid-to-high levels if they can’t get full attacks with Two-Weapon Fighting to multiply their Sneak Attack damage. At low levels, it could be a useful trick.
Of course, with the various ways that Pathfinder has shafted rogues’ ability to Sneak Attack multiple times in a round, it may be the best you can hope for. Unfortunately, it’s not very good.
There are a lot of different ways someone can be denied their DEX bonus to AC, so "it depends." So the first thing you need to note is that
d20PFSRD:
The rogue's attack deals extra damage anytime her target would be denied a Dexterity bonus to AC (whether the target actually has a Dexterity bonus or not), or when the rogue flanks her target.
You do NOT need an opponent to be flat-footed in order to sneak attack them. Now, being flat-footed does deprive you of DEX bonus to AC, so it also triggers sneak attack, but
a) flat-footed does more than just that, like prevent you from making AoOs, so read the condition and
b) there's a lot more ways of being deprived of your DEX bonus short of being flat-footed (blinded, stunned, the opponent being hidden, about a dozen feats, etc).
Confusing flat-footed with denied DEX to AC will lead you astray in many cases. When a rule says one that's what it means, and while flat-footed also means deprived of DEX to AC the converse is NOT true.
Surprise Rounds
During a surprise round, an opponent is flat-footed, and does not lose the flat-footed condition until their first action. So they may be sneak-attacked with impunity by multiple attackers, or multiple times by you if you can somehow do that in the one action a surprise round gives you.
Invisibility
Unless you have improved invisibility, with normal invisibility you become visible as soon as you attack, so the target is only denied their DEX bonus to AC for the first attack. They are NOT flat-footed, so can take attacks of opportunity if they know where you are. If they know you're there from a DC20 Perception check, I'd say it's a little ambiguous RAW-wise whether they'd get an AoO from, for example, you attacking from invis with a combat maneuver that provokes (grappling them without Improved Grapple for example) - most GMs would rule not, but be advised that invis isn't perfect and has a lot of caveats in its description.
Other
There's a lot of ways to lose DEX to AC and they're all different, and whether they persist for one attack or one round or forever is all based on the specific power.
Also see
Best Answer
In your question you have given us two use cases.
First lets look at the critical terms.
Flanking:
Swarms:
Sneak Attack:
So with those clearly defined lets look at the use cases;
Swarm Skin:
This power clearly states that you cannot use "any of your own abilities or take any actions other than controlling the swarms" so this will exclude sneak attack completely.
Verminous Transformation:
This power does not limit your actions or your abilities. So any attacks you make could benefit from sneak attack as long as you meet the criteria. The standard action that it gives can also benefit from sneak attack.