Typically, you will be asked prior to testing whether or not you take any prescription medications. What you must do is bring proof of prescription, such as the bottle when taking the drug test so that it doesn't affect the possible offer of employment.
If you can prove that you have a prescription for Xanax then you will not fail the drug test, if however the prescription is old or you can provide proof then you would fail.
As long as you have a valid prescription you cannot technicaly fail a drug test. If they do question it you will need to show them the prescription and they might test to see if you are adusing the prescription. More than likely they won't say anything. They never have to me.
The pre-employment drug test will probably screen for cannabis, cocaine, meth and other illegal drugs. If in fact your test result does report Xanax, your prescription will clear that up. You might mention your medications to the test administrator.
You will fail, but if you show them your prescription (dated properly, etc) you will probably be allowed to take the job; do not omit to tell them pre-test about the script.
The Xanax is certain to show up on the drug screen. Prior to taking the test, you should tell your employer that you have a prescription and provide proof of it. It is up to the employer whether or not they will still want to hire you; they are not obligated to do so.