A fundamental challenge for millimeter wave (mmWave) communications lies in its sensitivity to the presence of blockages, which impact the connectivity of the communication links and ultimately the reliability of the entire network. In this paper, we analyze a reconfigurable intelligent surface (RIS)-aided mmWave communication system for enhancing the network reliability and connectivity in the presence of random blockages. To enhance the robustness of hybrid analog-digital beamforming in the presence of random blockages, we formulate a stochastic optimization problem based on the minimization of the sum outage probability. To tackle the proposed optimization problem, we introduce a low-complexity algorithm based on the stochastic block gradient descent method, which learns sensible blockage patterns without searching for all combinations of potentially blocked links. Numerical results confirm the performance benefits of the proposed algorithm in terms of outage probability and effective data rate.