When applying for jobs I don't want to have a blank in my work history but if I can't get a reference how can I prove I worked here?
You must never have a blankan unexplained "blank" in your work history, but you don't need a reference for every company you have ever worked for.
On your resume, include the job as usual.
When supplying references, if you cannot find a friendly co-worker to be a favorable reference, simply don't supply one for this job.
The interviewer may ask why you omitted this company from your list of references. At that point, you can explain why. Most likely, you will have already explained why you aren't working there anyway.
It's not unusual to omit references from your current company on the grounds that "I don't want anyone there to know I'm planning on leaving." In your case you either quit or were fired, so that is a bit more difficult to apply.
I'm afraid they will bad mouth me and I won't have a chance to defend myself. What should I do to prevent my past employers from discouraging new employers from hiring me? Should I mention to potential employers that there were issues?
Omitting them as a reference may well avoid having them "bad-mouth you". Or not. When I'm interviewing candidates and they omit a well-known company from their references, I often have a friend or friend-of-a-friend who works there and can be a back-door reference. Thus, don't lie about the situation, or fudge the facts about why you left if asked. You don't necessarily need to volunteer any information, but be honest if questions come up.