For the moment, I can provide the basic overview of how not to get them killed:
Ashley is unaware that Udina and Cerberus are working together to lead the Councilors into a trap so Udina can take control of the Council. This puts Shepard and Ashley in conflict; Shepard must then convince Ashley into realizing the truth about what's going on and turning on Udina instead. If Shepard cannot persuade Ashley to back off, then Shepard can kill Ashley. If not, a squad member will shoot her.
Vague I know, I'll see if I can't update this with screenshots or a video soon for some exact choices.
Edit:
In this walkthrough, it shows that it seems the initial dialogue choice and whether or not you choose the Paragon interrupt determines if Ashley/Kaiden lives or dies during this encounter.