stealth in combat can be done several ways.
1. talents like "hide in plain sight" from Ultimate Combat and "stealthy sniper" (advanced player's guide) make it possible, you can fire from a range of at least 10 feet with some sort of cover/obstacle to hide behind without stealthy sniper, but you incur a -20 penalty to your stealth. The hide in plain sight suggests you can hide w/o any cover even while observed, and without penalty. Whether this includes enemies attacked or not is questionable.
2. something as simple as dim light can provide the conditions favorable to hide in and you could still get in the sneak attack as long as you have darkvision. this can be accomplished with a simple darkness spell so long as the light conditions are no more than normal light to begin with. (there are feats that still allow sneak attacks against opponents with miss chance due to concealment if you don't have darkvision and don't want to spring for goggles of night)
3. Invisibility offers a huge bonus to stealth. It also gives total concealment. Greater Invisibility would be necessary to continue fighting with stealth.
4. you can perform a bluff check opposed by the opponents sense motive to create a diversion giving you the opening you need to go hide after stabbing someone.
just remember that making the stealth check would be a move action in any case allowing for no more than one attack in any given round, generally speaking. And yes, as long as the target of your attack doesn't see you, you get sneak attack even if someone else can see you unless they have some ability that can remove his current flat footed condition. stick and move