Can an article "in press" (available online) be withdrawn/retracted? Nowadays, many journals publish articles online ahead of print, in a state that is given various names by the various publishers: in press, ASAP, just accepted, ahead of print, etc. The final printed paper will be identical with the online one, except maybe for page numbers and color figures… They can be cited through their DOI.

But if somebody, author or reader, were to find a fatal flaw with one such article, what should happen? Would the article be withdrawn (or retracted) before printing, or would it be printed nonetheless, then retracted later? And in any case, would the resulting paper be considered part of the scientific record, or not?
In your question you say "fatal flaw" and the answer will strongly depend on the meaning or intent with using these words. A fatal flaw might mean a figure is wrong; you may have submitted an earlier version of a figure you later revised. A fatal flaw may also mean you discover something that negates your results; you used the wrong equation or based your conclusions on the wrong data, both in ways that would pose serious risk. A third way to interpret the term is by personally simply disagreeing with what has been published, but my guess is that this is not what you are primarily thinking about and it is of course not grounds for any actions.

In the second case, retraction could be the only way forward. You should of course make the journal aware of this as soon as possible and ask for their suggested solution. If you have your paper published online but not yet printed, the journal (publisher) might retract it and it will never be printed. If it is printed they might retract it and probably print a note in a following issue to that fact. See examples for why in The New England Journal of Medicine

In the first case, the journal will likely publish an erratum, publish the correct figure to follow up on the example. Anything that is of a technical nature and can be rectified by providing the correct version will be done so through errata,. In print this will be included also in a subsequent issue.

Elsevier, for example, summarizes their rules and provides the following grounds for retraction:


  
  Article withdrawal: Only used for Articles in Press which represent early versions of articles and sometimes contain errors, or may have been accidentally submitted twice. Occasionally, but less frequently, the articles may represent infringements of professional ethical codes, such as multiple submission, bogus claims of authorship, plagiarism, fraudulent use of data or the like.
  Article retraction: Infringements of professional ethical codes, such as multiple submission, bogus claims of authorship, plagiarism, fraudulent use of data or the like. Occasionally a retraction will be used to correct errors in submission or publication.
  Article Removal: Legal limitations upon the publisher, copyright holder or author(s).
  Article Replacement: Identification of false or inaccurate data that, if acted upon, would pose a serious health risk.
  


In essence, if something is officially published with a doi, there is no way to get corrections made in the pdf or in print. The online version must correspond to the printed and so the solution becomes providing a correction later on.

Anything that has published will be possible to see. A paper that has been retracted will just be associated with a clear sign that a retraction has been made. The paper might live on through older copies on peoples computers or in their desk drawers.

There is an article in PLOS one that provides a perspective on retractions in general and which may be of interest.