You can override the css style to achieve this.
Follow the example at Grid Styling - Overwrite style of ag-grid but use this override:
styles: [`.ag-root .ag-floating-top {overflow-y: hidden !important;}`],
The same can be applied for any pinned bottom rows by changing .ag-floating-top to .ag-floating-bottom.