The widespread availability of electronic health records (EHR) promises to usher in the era of personalized medicine. However, the problem of extracting useful clinical representations from longitudinal EHR data, sometimes called computational phenotyping, remains challenging, owing to the heterogeneous, longitudinally irregular, noisy and incomplete nature of such data. In this paper, we explore flexible deep state space models for phenotyping longitudinal EHR data. These models explicitly account for the longitudinal nature of the data and are able to seamlessly deal with noise, heterogeneity and missing data issues. Our initial experiments produce promising results, and demonstrate the effectiveness of the learned representations in better discriminating between controls and cases in cohorts of congestive heart failure and chronic obstructive pulmonary disease patients.