During a biopsy especially a needle biopsy you'll be put in a sleep like state using general anesthesia which will allow the doctor to perform the biopsy without you feeling anything or knowing anything about it.
Other types of biopsies the doctor should also give you general anesthesia so you don't feel the biopsy.