Infections with Clostridium difficile are a health threat, yet no products are currently licensed for prevention of primary C difficile infections. Intravenous β-lactam antibiotics are considered to confer a high risk of C difficile infection because of their biliary excretion into the gastrointestinal tract and disruption of the gut microbiome. ribaxamase (SYN-004) is an orally administered β-lactamase that was designed to be given with intravenous β-lactam antibiotics to degrade excess antibiotics in the upper gastrointestinal tract before they disrupt the gut microbiome and lead to C difficile infection. We therefore aimed to determine whether administration of ribaxamase could prevent C difficile infection in patients being treated with intravenous ceftriaxone for a lower respiratory tract infection, thereby supporting continued clinical development. In this parallel-group, double-blind, multicentre, phase 2b, randomised placebo-controlled trial, we recruited patients who had been admitted to a hospital with a lower respiratory tract infection with a pneumonia index score of 90-130 and who were expected to be treated with ceftriaxone for at least 5 days. Patients were recruited from 54 clinical sites in the USA, Canada, Bulgaria, Hungary, Poland, Romania, and Serbia. We randomly assigned patients older than 50 years to groups (1:1) in blocks of four by use of an interactive web portal; these groups were assigned to receive either 150 mg ribaxamase or placebo four times per day during, and for 72 h after, treatment with ceftriaxone. All patients, clinical investigators, study staff, and sponsor personnel were masked to the study drug assignments. The primary endpoint was the incidence of C difficile infection, as diagnosed by the local laboratory, in patients who received at least one treatment dose, and this outcome was assessed during treatment and for 4 weeks after treatment. This study is registered with ClinicalTrials.gov, number NCT02563106. Between Nov 16, 2015, and Nov 10, 2016, we screened 433 patients for inclusion in the study. Of these patients, 20 (5%) patients were excluded from the study (16 [4%] patients did not meet inclusion criteria; four [1%] patients because of dosing restrictions). We enrolled and randomly assigned 413 patients to groups, of whom 207 patients were assigned to receive ceftriaxone plus ribaxamase and 206 patients were assigned to receive ceftriaxone plus placebo. However, one (<1%) patient in the ribaxamase group withdrew consent and was not treated with ribaxamase. During the study and within the 4 weeks after antibiotic treatment, two (1·0%) patients in the ribaxamase group and seven (3·4%) patients in the placebo group were diagnosed with an infection with C difficile (risk reduction 2·4%, 95% CI -0·6 to 5·9; one-sided p=0·045). Adverse events were similar between groups but more deaths were reported in the ribaxamase group (11 deaths vs five deaths in the placebo group). This disparity was due to the higher incidence of deaths attributed to cardiac-associated causes in the ribaxamase group (six deaths vs one death in the placebo group). In patients treated with intravenous ceftriaxone for lower respiratory tract infections, oral ribaxamase reduced the incidence of C difficile infections compared with placebo. The imbalance in deaths between the groups appeared to be related to the underlying health of the patients. Ribaxamase has the potential to prevent C difficile infection in patients treated with intravenous β-lactam antibiotics, and our findings support continued clinical development of ribaxamase to prevent C difficile infection. Synthetic Biologics.